ruby-on-rails-3.2

Rails 3.2 and Ransack - Is it possible to pass additional params in a sort_link?

江枫思渺然 提交于 2019-12-01 10:56:17
All is in the title... Using rails 3.2.11 and Ransack all works fine... I added a functionality to let my users choose the number of items to show per page and it works fine too, but I lose the "per_page" choice when I click on the sort_link As I can pass additional params to will_paginate like this <%= will_paginate :params => {:pp => params[:pp]} %> Is there a way to do the same thing with a Ransack sort_link ? Cheers I have found it ! Solution : <th><%= sort_link(@q, :profile_last_name, 'Last name',{:pp => params[:pp]}) %></th> Cheers 来源: https://stackoverflow.com/questions/15272095/rails-3

Subdomain with Rails and herokuapp

橙三吉。 提交于 2019-12-01 10:53:45
I have followed Ryan Bates railscast on subdomains ( http://railscasts.com/episodes/123-subdomains-revised ) and have my app working perfectly locally. I have deployed to heroku but am unable to get my subdomains to work. I have read about custom domains, DNS and CNAME records but I don't think this is relevant because all I am trying to do is test straight on heroku what I was testing locally. So instead of accessing myapp.herokapp.com I would like to be able to access m .myapp.herokuapp.com. Currently when I try this I get the error: There is no app configured at that hostname. Can anyone

Sass @import directive when used in Rails engine can't find assets in plugins

孤人 提交于 2019-12-01 10:38:38
I was building a Rails engine that uses zurb-foundation's stylesheets, and kep hitting the same Sass::Syntax error. This seemed strange because I had followed the same procedure in a Rails application and it was worked on the first try. So I decided to zero in on the isse by starting two new rails projects--one application and one engine--and configure them to use foundation with a minimal amount of setup. I started with 2 clean Rails 3.2.9 projects--one application and one engine --full and configured them both manually for foundations by adding foundation_and_overrides.scss and require -ing

in rails how to limit users post count saved in database before asking to upgrade their account

爱⌒轻易说出口 提交于 2019-12-01 10:03:45
问题 I'm adding a small way of controlling a non-subscribed user and a subscribed user. Basically my idea is that all users that sign up with the use of Devise, get an account. However, my model or the number of posts a user can have in the database stored based on user ID found should be 25 posts. I'm guessing the following would work; Model class Post belongs_to :user validate :quota, :on => :refresh def quota Posts = Posts.find(params[:id]) if user.posts.count >= 25 flash[:error] = "Sorry you

Missing current folder Capistrano Rails 3.2

旧巷老猫 提交于 2019-12-01 09:30:53
问题 I need to understand why capistrano doesn't create the folder current. I'm using the following command : cap deploy:setup, cap deploy:check, cap deploy But when i check in my app directory, i don't current folder. This my deploy.rb # Execute "bundle install" after deploy, but only when really needed require 'bundler/capistrano' # Automatically precompile assets load "deploy/assets" # RVM integration require "rvm/capistrano" # Application name set :application, "app" # Application environment

undefined method `email' for nil:NilClass in Exibe the mail of table Father

放肆的年华 提交于 2019-12-01 08:54:43
问题 I have a problem, i make this atribbuition i comment model: class Comment < ActiveRecord::Base attr_accessible :comment belongs_to :post belongs_to :user and this in user model class User < ActiveRecord::Base attr_accessible :email, :password, :password_confirmation has_many :posts has_many :comments but this dont works: <% post.comments.each do |comment| %> <div id="comments" > <%= comment.user.email %> <%= comment.comment %> </div> <%end%> appear the error: undefined method `email' for nil

“.save” only inserts null values in database

空扰寡人 提交于 2019-12-01 08:48:28
问题 I'm trying to make a RoR application for a Hospital so it has patients, doctors, offices, etc. The problem I'm having is that, at the patient "Sign-up", I'm not able to save the new patient in the database. In fact, despite I've checked that the attributes are ok (It's just a name and a personal ID), once the method is excecuted, in the database only appears a new row with "<null>" instead of the actual attribute values. Here's the method: def pat_create pName = params[:name].to_s id = params

How can i prefill datetime_select with times in custom time zone?

人走茶凉 提交于 2019-12-01 08:47:39
I have events that can be in different time zones . Upon edit I want the time & date to show with the time zone of that very event. However, when I hit edit , datetime_select always shows the time of the users time zone (as opposed to the one of the event). Example: Event starting at 10 a.m. in Amsterdam (GMT+1) Users time zone configured as London (GMT+0) Result: Upon edit the event time is falsely preset to 9 a.m. Code snippet: def edit Time.zone = @event.time_zone @event.beginn = @event.beginn.in_time_zone @event.endd = @event.endd.in_time_zone # [...] end Note that @event.time_zone

Rails 3.2 and Ransack - Is it possible to pass additional params in a sort_link?

六眼飞鱼酱① 提交于 2019-12-01 08:42:31
问题 All is in the title... Using rails 3.2.11 and Ransack all works fine... I added a functionality to let my users choose the number of items to show per page and it works fine too, but I lose the "per_page" choice when I click on the sort_link As I can pass additional params to will_paginate like this <%= will_paginate :params => {:pp => params[:pp]} %> Is there a way to do the same thing with a Ransack sort_link ? Cheers 回答1: I have found it ! Solution : <th><%= sort_link(@q, :profile_last

Subdomain with Rails and herokuapp

那年仲夏 提交于 2019-12-01 08:20:39
问题 I have followed Ryan Bates railscast on subdomains (http://railscasts.com/episodes/123-subdomains-revised) and have my app working perfectly locally. I have deployed to heroku but am unable to get my subdomains to work. I have read about custom domains, DNS and CNAME records but I don't think this is relevant because all I am trying to do is test straight on heroku what I was testing locally. So instead of accessing myapp.herokapp.com I would like to be able to access m .myapp.herokuapp.com.