In the controller, how can I add a variable at the end of a params[]?
If I try this I get an error: params[:group_] + variable
How should it be done?
Edit per request
Ok, I have a form that sets groups of radio buttons with names like this:
group_01DRN0
Obviously I have different groups in the form (group_01AAI0, group_01AUI0, et...
Definitions: resource = collection of database records, regeneration = processing these records and outputting the corresponding html
Current flow:
Receive client request
Check for resource in cache
If not in cache or cache expired, regenerate
Return result
The problem is that the regeneration step can tie up a single server process...
What is the best way to implement real time updates in ruby on rails using node.js? It would be great to hear either real examples or your thoughts on alternative solutions.
...
Im using like this:
def child_render
super_render {
print GridModule.new.render
}
end
def super_render
@yield_value = yield
end
and got: Cannot yield from a Proc type filter. The Proc must take two arguments and execute #call on the second argument.
...
I have a date range that I would like to be able to loop through in reverse. Give the following, how would I accomplish this, the standard Range operator doesn't seem t be working properly.
>> sd = Date.parse('2010-03-01')
=> Mon, 01 Mar 2010
>> ed = Date.parse('2010-03-05')
=> Fri, 05 Mar 2010
>> (sd..ed).to_a
=> [Mon, 01 Mar 2010, Tu...
I'm trying to build a site with RoR on Google App Engine. I'm using the google-appengine gem (http://appengine-jruby.googlecode.com) and following the instructions in (http://gist.github.com/268192). The problem is that I can't submit ANY form!
I've already tried this in two diferent clean Win 7 Pro envs and the result is the same.
Aft...
I have built a custom form for creating a joining model on a has_many :through relationship. The models look roughly like this:
class Team
has_many :team_members
has_many :members, :through => :team_members
end
class Member
has_many :team_members
has_many :teams, :through => :team_members
end
class TeamMember
belongs_to :tea...
Using Ruby on Rails 3's new routing system, is it possible to change the default :id parameter
resources :users, :key => :username
come out with the following routes
/users/new
/users/:username
/users/:username/edit
...etc
I'm asking because although the above example is simple, it would be really helpful to do in a current projec...
Hi everyone!
This is my first post on Stack Overflow. I am trying to build a system that authenticates three types of user with completely different site experiences: Customers, Employers, and Vendors.
I'm thinking of using a polymorphic 'User' table (using AuthLogic) with username, password, and user_type (+ AuthLogic's other required...
I have a ruby view that has this namespace: ActionView::Base.new but i want to add a new method to be available to this ActionView::Base class.
...
I posted a question awhile ago asking how I could limit the rate at which a form could be submitted from a rails application. I was helped by a very patient user and their solution works great. The code was for my comments controller, and now I find myself wanting to add this functionality to another controller, my Messages controller. I...
Hi everyone,
I have a large database I need to populate with data before initially running the application. Is it best to do this in an external rake task or inside migrations?
Sincerely,
Tyler
...
Hi
Im having issues with RESTful URLs in Rails.
I have site.com/services url, and I want to have subpages under that category, thats it: site.com/services/arquitecture, site.com/services/plumbing, etc.
The pages that im serving under that category are "static" .rhtml files and I would want them to be on the same controller.
Is there ...
I've changed my model from
class Place
include DataMapper::Resource
has n, :trails
property :id, Serial
property :name, String, :length => 140
property :tag, String, :required => true
timestamps :at
end
to
class Place
include DataMapper::Resource
has n, :trails
property...
I have a standard query that gets the current user object:
@user = User.find_by_email(session[:email])
but I'm putting it as the first line in every single controller action which is obviously not the best way to do this. What is the best way to refactor this?
Do I put this as a method in the Application controller (and if so, can y...
I'm trying to define a step to test the value of alt text of an image using capybara and the css selectors.
I wrote one for input values based on the readme examples:
Then /^I should see a value of "([^\"])" within the "([^\"])" input$/ do |input_value, input_id|
element_value = locate("input##{input_id}").value
element_value.s...
Every time I try to debug my Rails app via Netbeans I get a ...
"Could not connect to web server - cannot show http://localhost:3000"
Rails - 2.3.5
Ruby - 1.8.7-p249
Anyone know how to resolve this?
Thanks
...
Rails: url_for to be available in a isolated class that must be instanced:
class ProfilePresenter < ActionController::Base
attr_reader :profile
def initialize(profile)
super
@a = url_for(:controller => 'profiles', :action => 'view', :profile_url => 'dd')
@a
@profile = profile
end
en...
I'm using tabnav plugin for Rails and I want to use rpsec to make sure it highlights properly.
describe 'account navigation links' do
it 'should have account settings link' do
get '/account/settings'
response.should have_tag("li", :text => "Account Settings")
end
it 'should be highlighted' do
get '/account/settings'
resp...
Hi all,
I'm trying to set up a simple login using AuthLogic into my User table. Every time I try, the login fails and I don't know why. I'm sure this is a simple error but I've been hitting a brick wall with it for a while.
#user_sessions_controller
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.sa...