如何在设计中创建后确认重定向?
在我第一次添加confirmation module
自定义after_sign_up_path
工作正常之前,login/signup
但现在当我单击电子邮件中的确认链接时,它会重定向到我为登录后路径设置的路径(用户配置文件).
我的目标是创建表单向导和"入门"页面以收集其他信息.显而易见的警告是,这种重定向只会在确认后发生一次.
我已经尝试了一些已经在堆栈上发布的其他解决方案,但它们似乎都不再工作了..
我使用以下代码片段来促进我的同位素实现的实时搜索.
它工作得很好,但我想知道是否有办法限制它搜索的范围.
我们的同位素返回HTML如下:
<div class="item">
<span class="title"></span>
<span calss="description"></span>
Run Code Online (Sandbox Code Playgroud)
现在它搜索所有内容,我如何限制它只过滤"标题"字段的结果?
jQuery(document).ready(function($) {
$(document).ready(function(){
var $container = $('#portfolio'),
// create a clone that will be used for measuring container width
$containerProxy = $container.clone().empty().css({ visibility: 'hidden' });
$container.after( $containerProxy );
// get the first item to use for measuring columnWidth
var $item = $container.find('.portfolio-item').eq(0);
$container.imagesLoaded(function(){
$(window).smartresize( function() {
// calculate columnWidth
var colWidth = Math.floor( $containerProxy.width() / 5 ); // Change this number to your desired amount of columns
// …
Run Code Online (Sandbox Code Playgroud) 我使用多步形式(使用Wicked gem).在表单的前几个步骤中,我正在编辑用户模型,这些步骤工作正常.然后,我尝试与用户模型具有HABTM关系的"兴趣"模型.但是我得到这个错误:
ActiveModel::MassAssignmentSecurity::Error in UserStepsController#update
Can't mass-assign protected attributes: interest_ids
Rails.root: /Users/nelsonkeating/rails_projects/Oreminder1
Application Trace | Framework Trace | Full Trace
app/controllers/user_steps_controller.rb:12:in `update'
Run Code Online (Sandbox Code Playgroud)
user_steps_controller.rb
class UserStepsController < ApplicationController
include Wicked::Wizard
steps :standard, :personal, :interests, :dates
def show
@user = current_user
render_wizard
end
def update
@user = current_user
@user.attributes = params[:user]
render_wizard @user
end
end
Run Code Online (Sandbox Code Playgroud)
继承人看法:
<%= render layout: 'form' do |f| %>
<% for interest in Interest.find(:all) %>
<label class="checkbox">
<%= check_box_tag "user[interest_ids][]", interest.id, @user.interests.include?(interest) %>
<%= interest.name %>
</label>
<% …
Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用简单的表单来获得用户的生日.
设置(并且我想保持这种方式)回到1900年,但我想知道是否有一种方法可以将默认开始设置为1950(如果需要,它们仍然可以回滚到更旧)所以大多数用户不必滚动到目前为止达到他们的年龄.
<%= f.input :date_of_birth, :as => :date, :start_year => 1900,
:end_year => Date.today.year - 12,
:order => [ :day, :month, :year], :required => true %>
Run Code Online (Sandbox Code Playgroud)
谢谢!
我无法为我的应用程序设置重定向.用户应该转到他们的个人资料(用户/节目)和管理员应该去管理仪表板..我如何设置它?
目前收到以下错误:
NameError in ActiveAdmin::Devise::SessionsController#create
undefined local variable or method `admin' for #<ActiveAdmin::Devise::SessionsController:0x007febe12667e8>
Run Code Online (Sandbox Code Playgroud)
应用控制器
def after_sign_in_path_for(resource_or_scope)
if admin
redirect_to admin_dashboard_path
else
@user
end
end
end
Run Code Online (Sandbox Code Playgroud) ruby-on-rails devise ruby-on-rails-3 ruby-on-rails-3.1 activeadmin
我的网站位于:http://math.pixelworklab.com/home-study
我想在两页上隐藏导航栏
基本上防止用户在结账时被其他链接分心.
如何使用IF语句在这些页面上隐藏此div?
更新:
/*导航*/
if ( ! function_exists( 'woo_nav' ) ) {
function woo_nav() {
global $woo_options;
woo_nav_before();
?>
<?php if (strpos($_SERVER['REQUEST_URI'],'/checkout/') === false
|| strpos($_SERVER['REQUEST_URI'],'/cart/') === false ):?>
<div id="navigation" class="col-full">
<?php woo_nav_inside(); ?>
<?php
if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'primary-menu' ) ) {
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'primary-menu' ) );
} else {
?>
<ul id="main-nav" …
Run Code Online (Sandbox Code Playgroud) 我正在尝试获取当前用户 ID 并将其作为变量传递到 JavaScript 函数中(请参阅“USER_ID_GOES_HERE”)。这样做的最佳实践是什么?
这是我的功能:
function hide_loading() {
Wild.onChartsReady(function() {
var series = new Wild.Series("Viewed Post", {
analysisType: "count",
timeframe: "this_week",
interval: "daily",
groupBy: "title",
filters: [{"property_name":"author","operator":"eq","property_value":'USER_ID_GOES_HERE'}]
});
series.draw(document.getElementById("mine"), { lineWidth: 2 });
});
}
Run Code Online (Sandbox Code Playgroud) 注意:我在OSX 10.6.6上
我使用RVM成功安装了1.9.2.这样做后我运行了rvm --default使用1.9.2,它似乎也运行正常.Ran Ruby -v命令确定1.9.2出现了.
现在,我关闭了我的终端会话并打开了一个新会话,运行ruby -v并恢复到1.8.7
我删除了rvm,重复安装,同样的事情发生了.
有任何想法吗?
谢谢
我过去几个月一直在学习Ruby,更具体地说是rails框架,现在我正准备深入研究Javascript.我知道任何好的/现代的rails应用程序都会在其代码中包含javascript.我也知道Javascript/Jquery/Coffescript有助于为Web应用添加一些交互性,样式和功能.
我的问题是,JS(或Jquery/Coffescript等)与Ruby/Rails的标准问题/特征是什么?
将整个YouTube频道嵌入网站的最佳方法是什么?看起来"自定义播放器"生成器最近停产了..
我正在寻找的不只是带滚动条的视频.我想尽可能地复制实际频道的体验(例如参见截图).
任何人对如何实现这一点有任何想法?
注意:我有一个wordpress网站,并没有看到任何插件?
wordpress ×3
javascript ×2
jquery ×2
php ×2
ruby ×2
activeadmin ×1
associations ×1
coffeescript ×1
devise ×1
macos ×1
video ×1
youtube ×1