Raymond Brigleb
2005-Apr-24 16:46 UTC
Question about creating a controller(?) for feeding XML + map.connect...
Hello there, I have a question about something that''s been stumping me for several days, I just gotta ask. Maybe someone can help me get over this li''l hurdle. I''m trying to give my application a sort of XML feed. All of my existing controllers and views require authentication, so I''m trying to create a fresh one to just feed XML. So that, say, it can handle requests to website.com/feed/8 and just get a feed from there -- authentication is totally unnecessary for this purpose.... So my question is, how do I do this? I can''t really see if it''s okay to create a separate view like this without making a database table and so forth, I can''t quite get my head around it. Can you just create a view and a controller without creating a model? Or do I maybe *want* a model? Just not sure how to approach this. This kind of ties into another problem of mine... The API docs make reference of using map.connect to define mapping throughout the site, and in the example I''m looking at, David uses an example like this: map.connect ''clients/:client_name/:project_name/:controller/:action'' ... but where is :client_name and :project_name coming from here? This is kind of related to my other question, so I thought I''d blurt it out too. Okay, I''ll keep my hand down for a while... any help would be greatly appreciated, even if it''s just to send me a lead or two. I''m willing to read as much as necessary, but right now I feel like I''ve read everything in the Wiki and API thrice in as many days, and this little throbbing in my head tells me to just come out and ask the damn question. Kindest of regards, Raymond
Rick Olson
2005-Apr-24 21:00 UTC
Re: Question about creating a controller(?) for feeding XML + map.connect...
Views and Controllers don''t need models. You can create a route like map.connect ''feed/:id'', :controller => ''feeds'', :action => ''show'' as for map.connect ''clients/:client_name/:project_name/:controller/:action'': When you make URLs with url_for (or link_to, redirect_to, form, etc), you give it :client_name and :project_name. When someone accesses the above URL, those 2 fields are available as @params[:client_name] and @params[:project_name]. I hope this helps some. -- rick http://techno-weenie.net