similar to: Proper use of params

Displaying 20 results from an estimated 200000 matches similar to: "Proper use of params"

2005 Dec 15
3
Another session question
I want to give a user a form to create a new Product, but instead of persisting the product to the database I want to store it in a session first for category assignment, etc.. (in other controllers) So when the user describes the product on the form I have a "Save and Continue" button pointing to the action add_to_product_factory: def new_product @product = get_product end
2005 Dec 16
3
Help with error
I am getting this error NoMethodError in Admin#add_to_project undefined method `find'' for #<Project:0x249da88> RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/ base.rb:1501:in `method_missing'' ./script/../config/../app/controllers/admin_controller.rb:65:in
2006 Jun 02
4
Creating an array of params
I''ve got a bunch of text fields that I''d like to access as an array. The code looks like this: <%= text_field_tag "people[0][entry]" %> <%= text_field_tag "people[1][entry]" %> <%= text_field_tag "people[2][entry]" %> So when I submit the form, I''d like to be able to use it like params[:people].each {|p| p[:entry]}
2006 Apr 26
0
Validation of params
As we all know you cannot trust anything you receive from the internet. I am wondering what the correct RoR way is to solve this. For the model there are various validates_* methods that you can use to ensure some integrity of that part. That is good by itself. Though it would be nice if setting these would also result in enforcement in the database backend itself when supported. Here I am as
2006 Jun 29
1
preserving params across redirects
Hi, Is there a way to preserve the params along with redirects? or the only way is to set persist in session? Is this the RoR way? Thanks, Hari -- View this message in context: http://www.nabble.com/preserving-params-across-redirects-tf1870312.html#a5111902 Sent from the RubyOnRails Users forum at Nabble.com.
2012 Nov 06
1
Proper deployment steps + next steps of learning RoR
I''m new to RoR and going through the tutorials trying to learn as much as possible. I have actually two questions: 1. What is a proper way to deploy an app into the PROD environment? Here is what I''m trying to avoid: when writing/testing application (ie. new user signs ups) on my local machine, I don''t want these users to be deployed into the PROD environment along
2009 Feb 10
2
form_remote_for NOT passing param: I want put and I get post
Hello, I''m struggling my brain with this ajax issue ... Basically I have a form for creating records, and I want to submit it using Ajax. On previous versions of RoR (2.0.2) it was working, but the same methods doesn''t work on 2.2.2, and I started to make changes and changes and read forums and the api, but no way ... <% form_remote_for (:expedient, :url => {:action
2006 Mar 15
5
Passing params to a component
I see from http://rubyonrails.org/api/classes/ActionController/Components.html that is possible to pass paramaters to a component. I don''t understand the exact syntax. I''m trying: @master_id = @params[''master_id''] in the components controller but it is not working. ==== Details: In my calling view I have: <%= h(@opportunity.id) %> <div
2009 Sep 25
3
NoMethodError : undefined method `stringify_keys!' for "2":String
Hi, I have been trying to create a small Rails application. In one of the steps, I am facing this error as "NoMethodError in ContactController#update ...... undefined method `stringify_keys!'' for "2":String". Let me give a brief description of the application. This application is to Create, View and Update contacts. The problem came when updating a record.
2013 Feb 28
1
how to use before_filter to decrypt post data
hello, everybody. in ror, we can add a after_filter to a controller. def aes_encrypt response.body = AesHelper.aes_encrypt(response.body) end after_filter :aes_encrypt and all action''s repsonse int the controller can be encrypt. and my question is , how to decrypt data use before_filter, or anything else. ex: i want to post json data to /usr/register, the json data is
2006 May 14
3
Beginner question on paginate with params and conditions
I am trying to do a simple search by product name. The first page returns fine, but when I try to go to any other pages of the search results, I lose the original search parameters from my search form and get NilClass errors. Here is the code in my controller: namesearch = "%" + params[:name].strip + "%" @product_pages, @products = paginate :product,
2006 Feb 25
2
How to access param entered through text_field
I''m rendering partial a form comprising several text_field helpers to maintain my User model. For example, the email field is: <p><label for="user_email">Email</label><br/> <%= text_field ''user'', ''email'', :size => ''40'', :maxsize => ''256'' %></p> In my controller,
2010 Dec 31
1
Parsing params (one of the params value has ampersand)
Hello, I am trying to parse a URL of this format http://example.com/links?deal_id=161&url=http://another_example.com/index.php?route=product/product&product_id=275 I need to get 2 params deal_id and url However, in the above example, if I do params[:url], then I get "http://another_example.com/index.php?route=product/product" product_id=275 is dropped on the floor as its
2006 Jan 30
3
params on controller and view
Hi, I have a link that says: <%= link_to_remote("Data", :update => ''pie_graph_div'', :url => { :action => :show_pie_graph, :mode => ''nums'' }) %> which calls *show_pie_graph*: Controller: def show_pie_graph render :layout => false @mode = params[:mode] end View: <img src="/surveys/make_pie_graph/<%=@mode%>"
2006 Sep 22
1
url_for params
Hi, url_for has a nice way of using the current ''params'' object to fill in default parameters in a route. For example, map.connect '':controller/:action/:id/'' with <%= url_for :action => ''my_action'' %> will redirect to the current controller. All very good. However, I sometimes want a url_for() which includes current parameters
2008 Jun 05
3
what is proper way to load lookup/reference data into test database?
I''m just getting into writing tests for my first RoR app. I''ve got a few data migrations to load reference data (i.e. 2-char state abbrevs, payment types, etc.). How do I get that data into the test database? I understand fixtures are to load test data. But if I duplicate these lookup tables in test fixtures, it seems like that is violating the DRY principle. Is that OK in
2010 Jan 05
2
Conditional named_scope chaining with params (Need help)
Hello there, I have a model that has more then one named_scope. In my action Index of the controller that handle this model I want to do this in a drier way: if params[:ownership] == "mine" @posts = Post.tagged_with(params[:tags], :on => :tags).owner(current_user.id).paginate :all, :page => params[:page], :order => ''created_at DESC'' else
2011 Oct 05
3
Rails 3 routes with same name, different param name based on constraint
Hello there fellow RoR enthusiasts, I have been wrestling with rails 3 routes for hours trying to accomplish the following: I want to use the *same url helper* (photo_url) in my views but have a different route match made depending on the format of the parameter I pass. Seems simple enough, right?? If the parameter looks like nn.nn.nnnnnn.whatever, I want the param passed to
2008 Feb 19
2
sending mail [not the ActionMailer way?]
Hi folks, I''ve recently stepped away from PHP web dev and I''m trying out ROR now. I like it so far. But there''s something I cannot figure out on my own. Searching on the API of ROR and Google about the possibilities of sending emails with ROR only gave me the ActionMailer way of sending mails. What I want to do is to send a mail where the body is submitted by a user.
2008 Sep 18
2
Setting up Fleximage
Hello! I''ve been trying today to setup fleximage to handle photo uploads to a RoR application by following the tutorial that is provided (http://github.com/Squeegy/fleximage/wikis/gettingstarted) Originally, I just dropped in all of the sample code that they provided, which I copied below this question. - When I tried to access "new" to upload a new photo, I received an error