If I want to link from/redirect via the index page (which I notice will not process as erb), what''s the local relative path I should use to the the view (object/method don''t work)? I am getting to like rails so I will probably stick with it. Does anyone have anything to say (pro and contra, please) about the various "Ruby on Rails" books that are available? -- Posted via http://www.ruby-forum.com/.
Mk 27 wrote:> If I want to link from/redirect via the index page (which I notice will > not process as erb)Huh? *What* won''t process as ERb?> , what''s the local relative path I should use to the > the view (object/method don''t work)?Let Rails build the path for you. Take a look at url_for and/or named routes. It''s uncommon to need to specify literal URLs in a Rails app.> > I am getting to like rails so I will probably stick with it.Cool!> Does > anyone have anything to say (pro and contra, please) about the various > "Ruby on Rails" books that are available?Even though many of the books out there seem to be excellent, book publishing moves slowly, and Rails core development moves very fast, so books can get obsolete pretty quickly. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Marnen Laibow-Koser wrote:> Mk 27 wrote: >> If I want to link from/redirect via the index page (which I notice will >> not process as erb) > > Huh? *What* won''t process as ERb?public/index.html I copied my (working) application.html.erb from app/layouts, made some appropriate modifications, and named it "index.html.erb". When I start the server and go to localhost:3000, it does read the page but it spits out the <%ruby%> unparsed, like I suppose it would if I used apache. Anyway, I am sure I will get to know all the rails commands eventually, but since all the paths are absolute relative to one another, I would actually PREFER to know what they are/should be -- you cannot get simpler than typing a relative url, eg. it would literally be "app/views/section/list" (although this does not work). Ease of use is one thing, pointless opacity is another. So, can I ask that question again in the hopes of getting a real answer? I will investigate url_for and routes as well... -- Posted via http://www.ruby-forum.com/.
Mk 27 wrote:> Marnen Laibow-Koser wrote: >> Mk 27 wrote: >>> If I want to link from/redirect via the index page (which I notice will >>> not process as erb) >> >> Huh? *What* won''t process as ERb? > > public/index.htmlRight. The public directory is for static assets. If you want a dynamic index page, then use map.root in routes.rb. [...]> Anyway, I am sure I will get to know all the rails commands eventually, > but since all the paths are absolute relative to one another, I would > actually PREFER to know what they are/should be -- you cannot get > simpler than typing a relative url, eg. it would literally be > "app/views/section/list" (although this does not work).This is a bad idea. I know it may seem simpler, but it really isn''t. The reason is that Rails controls URL mapping through the routes.rb file, so the URLs are not necessarily directly related to the object structure of the application. Specifying literal URLs will bypass a lot of the routing logic, which is generally not what you want.> Ease of use is > one thing, pointless opacity is another.This is not pointless opacity. It exists so you can provide nice URLs to your users without having to expose implementation details that users shouldn''t see.> > So, can I ask that question again in the hopes of getting a real answer?Learn how routing works in Rails (the rdoc is excellent on this topic). That''s the only real answer that I or anyone else can give you.> I will investigate url_for and routes as well...Please do. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Marnen Laibow-Koser wrote:> Learn how routing works in Rails (the rdoc is excellent on this topic). > That''s the only real answer that I or anyone else can give you.Okay...thanks for the explanation -- Posted via http://www.ruby-forum.com/.