similar to: to_param() / url generation Question

Displaying 20 results from an estimated 10000 matches similar to: "to_param() / url generation Question"

2013 Apr 12
1
What is the meaning of the method to_param?
Hey! Foe example i have next code: test "should update user" do put :update, id: @user.to_param, user: @input_attributes assert_redirected_to users_path end What return id: @user.to_param? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group
2008 Feb 20
0
#dom_id should use AR#to_param instead of AR#id
Hi, I have just commited a patch for ActionController''s #dom_id, it should iternally use AR#to_param instead of AR#id, because #to_param is used for routing representation of an ActiveRecord inside ActionPack. You can found the ticket here: http://dev.rubyonrails.org/ticket/11179. Luca. -- blog: www.lucaguidi.com --~--~---------~--~----~------------~-------~--~----~ You received
2010 May 13
1
Routing - newbie question about shorting the url
Hi Right now I have my url showing as the following: http://localhost/categories/italian/recipes/special-pasta-sauce I would like it to be: http://localhost/categories/italian/special-pasta-sauce (or even http://localhost/italian/special-pasta-sauce) my category model has_many :recipes and my recipes model belongs_to :category (for the purposes of my test project a recipe can only belong to one
2006 Jan 08
2
sorting issue
I''ve got the following setup: category (hm) <-> (bt) activity An activity has an amount, date, location, note, and category. I''m sorting my activities table by category_id (foreign key in activity), but how do I sort it by category_name instead? Basically I just need category_name in the result set. Here''s what I have now: @all = Activity.find(:all, :order
2006 May 17
6
ActiveRecord#to_param
Hello, to implement some some kind of optimistic locking, I want to build a view, where an object is displayed together with a link containing the data of the displayed object. My first try looked something like <%= object.object_discription %> <%= link_to "action", :action => "take_action", :data => object %> this won''t work because object is of
2005 Jul 22
1
A Bit Baffled By text_field
Hello. I am converting my Java app to Rails and I''ve hit something that has me a bit baffled. I''ve been fiddling with this for over an hour and trying many different combinations so at this point I''ve lost perspective. It''s probably something simple but I can''t see it anymore. I have a component that looks like this: <% for advertiser_category in
2006 Jan 24
2
Noob - port 3000 in URL''s - get rid of it?
Hi, total Noob here. I have a rails server set up and running. I''m working my way through the "agile" book. I see that all of the examples show URL''s that explicitly call for port 3000. How would one go about creating a ruby app that is engaged with a "normal" URL with no port number in it? That is apparently the default port for webrick to start up on
2007 Jan 24
2
A spec where interaction-based testing breaks down... (at least for now)
Here are the specs: context "Finding all the stylesheets available to a company" do setup do @mock_company = mock("company") @mock_company.stub!(:to_param).and_return "1" Stylesheet.stub!(:find) end def do_find Stylesheet.find_available_to @mock_company end specify "should convert the company into a parameter" do
2006 Feb 20
13
Agile Legacy Interop
I just wanted to announce my latest plugin: LegacyInterop The 5 second video, minus the video, looks like this: $ ./script/plugin install svn://lirp.rubyforge.org/var/svn/lirp/trunk/legacy_interop $ echo LegacyInterop.act_as_dotnet >> config/environment.rb Done! Agile! Pragmatic! The plugin includes support for a large number of legacy systems, all using the "act_as" pattern.
2007 Sep 18
2
rSpec / Nested Routes / Mocks
I''m having a terrible time trying to test a nested route with rSpec. I can''t seem to tell rSpec to expect the call @item.user. The following error message plagues me not matter how I try to fuss with the mock: Spec::Mocks::MockExpectationError in ''ItemsController handling POST / items should redirect to the new course on successful save'' Mock
2006 Feb 13
3
caches_action does not go off the entire URL
I am trying to use caches_action and the agile book says that it is keyed off the URL, however it does not seem to pick up the URL parameters. http://localhost:3000/controller/action/id?foo=bar and http://localhost:3000/controller/action/id?foo=foobar Returns the same page. Anyone looked into how to add URL parameters to the cached key? Also, where do those file get stored? Thanks Dave
2007 Jan 30
5
errors while testing resource controller using rpec
I am testing a resource called venue in this piece of code (generated using script/rspec_resource) ==================== context "Requesting /venues using POST" do controller_name :venues setup do @mock_venue = mock(''Venue'') @mock_venue.stub!(:save).and_return(true) @mock_venue.stub!(:to_param).and_return(1) Venue.stub!(:new).and_return(@mock_venue)
2005 Dec 25
2
Caching of models?
Hello, people! I have a problem. I googled, asked for help on IRC. I can''t find an answer. Suppose I have model Cart (from "Agile Web Development with Rails"). I added call to logger.warn("Some warning") to one of it''s methods. It fails with NameError, because ''logger'' is unknown to model. undefined local variable or method
2009 Oct 14
6
Reinstantiate controller during functional testing
... ok, I may be going about this the wrong way, or perhaps, a less efficient way than is optimal, but I would like to test a little bit of AJAX on one of my web pages. When I test this by hand, I bring up the page which shows a select box, I select an item from the drop down list, see another select box show up, go back to the first select box, select a different item, and see something
2006 Jan 23
8
yield vs @content_for_layout, etc..
I am relatively new to RoR and Ruby for that matter. A few questions for the pros: Question 1: In the 5min ajax video the presenter uses <%= yield %> in his layout. In the agile book, @content_for_layout is used. Since, yield is an actual Ruby construct, is it more efficient and preferred? What is the difference? Question 2: Links are often of the form :action =>
2011 Jan 16
1
Before and After Filters/Functions for Rails Routes
Hi I have an idea and I am not sure if is is already done.Right now to make url search engine friendly developers use to_param function of model class. Then they call to_s function to get the id of the elmenet. What if I want to create url for not model but for string. Lets say I create link for post controller''s search action. The only variable in the url is search_string. Si how
2005 Dec 29
3
Blank pages, ''missing default helper path rails_info_helper''
Environment: * OS X 10.4.3 * Ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0] * Rails (1.0.0, 0.13.1) * WEBrick 1.3.1 * Following the wiki directions, I did the OSX fixrbconfig thing, installed Rails, MySQL, etc.. Please bear with me, I''m new to Rails. I successfully followed the ''depot'' application from the Agile Web Development with Rails book, building it piece by
2008 Jan 21
2
multiple ids on restful action
Hi, I know this question has come up before, but I couldn''t find a satisfying answer. Maybe I didn''t look well enough, so any pointers to old messages regarding this subject would be welcome too. I need some way to pass multiple ids to a resource. Something like /posts/13,14 If I do this I have to manually split the id on ","s in the action, and use post_path([post1,
2007 Sep 28
2
form action url example
Hi, I have the following example: it ''should have a form with an action attribute'' do response.should have_tag( "form[action=?]", ''/users/1/machines/1/trouble_tickets'') end for a form like so: <% form_for( :trouble_ticket, :url => { :action => ''create'', :user_id => @machine.current_owner,
2006 Jan 04
5
routing title in url
I''ve set up my app to display a post by retrieving its title instead of id, which works fine, except it looks like this "/post/the+title+of+post%3F" and I want it to be "the_title_of_post?" with underscores instead of plusses. Can anyone shed light? -- Posted via http://www.ruby-forum.com/.