I have a text area in which I type on multiple lines…but when I
display it, it prints whole text in one line…how can I solve that?
Datatype is TEXT
I can see a list of all posts at …post/ with index method but I want
to see a particular post with …post/[id] … how can I do that?
I want my application to be completely secured and whatever page
unlogged in user tries to open, it should redirect to :controller =>
‘user’, :action => ‘login’ … some before_filter maybe but I dont know
where to put that to secure all of the application.
How to display a column of options from a table into a drop down
list, with id being their value.?
tag or you
change the CSS whitespace property. I would recommend formatting the
text field for display with simple_format(text). Read about it here: ActionView::Helpers::TextHelper
In your index action in the controller, add @post =
Post.find(params[:id]) if params[:id] and pass the id of the post you
want in the params
Use the login_required method in the authenticated_system.rb of
restful_authentication (or acts_as_authenticated) as a before_ftiler
or model yours after it. See the restful_authentication documentation.
like I have a table called statuses and in there I have some columns
including id and status_name
I want to get all the ids and status_names and display them in drop down
list with status_names being displayed in drop down but when submitted
value being the ids sent to database.
Use the login_required method in the authenticated_system.rb of
restful_authentication (or acts_as_authenticated) as a before_ftiler
or model yours after it. See the restful_authentication documentation.
that is some kind of plugin…could you please give link to some tutorial
on how to use that because I learned user authentication just a couple
of hours ago
I would definitely suggest that you familiarize yourself with the
basic concept of user authentication in rails before you start using a
plugin (so that you understand what the plugin does). The Agile Web
Dev. with Rails book has a user authentication section that goes over
it briefly. The restful_authentication plugin itself has excellent
README and RDoc documentation and the code is quite easy to follow as
well, so you may want to check it out. (the plugin is in
technoweenie’s plugin repository, google should find it for you
easily, and there are various resources online that can help you
integrate it, including a wiki for the original acts_as_authenticated
plugin)
It sounds like his get params are fubared. 4 is probably the id he
wants but he’s put it in the action param instead. Of course 4 could
also be the id of nil, but we’ve got whiny nils to prevent that
confusion.
Default rails routing is :controller/:action/:id which means that http://localhost:3000/post/4 gives the params { :controller =>
‘post’, :action => ‘4’, :id => nil }
You want params like { :controller => ‘post’, :action => ‘index’, :id
=> ‘4’ }