Things you should know in Ruby on Rails:
- Actions that you created in application controller will be available in all your controller but they are not available to views by default.
- To make those actions to be available to views, add this code in the same file:
helper_method :action1, :action2,and so on. - In Ruby,
"foo".equal? "foo"will returnfalseand:foo.equal? :foowill returntrueIt works that way because strings in Ruby are mutable. Unlike strings, symbols(:foo) are immutable. params[:foo]in@user = User.find(params[:id])means to tell rails to get the ':foo' or ':id' from the URL of the page that user requested
| In this case, params[:id] is 1 |

No comments:
Post a Comment