Manish N. wrote:
In params[:id] = 567 is passed. 567 is the id of music in table.
I am new to ROR so i dont know how to run application console. so please
Ah. Then you are in for a pleasant surprise.
The application console is one of the most amazingly useful parts of
Rails. To access it, you need a command window (a terminal on
UNIX/MacOS or a DOS window on Windows). If you are using Instant Rails
on Windows, then select “Open Ruby Console Window” from the “Rails
Applications” menu option.
Change directory so you are in the top level of your application. Then
run the command:
If you are running an older dumb(er) version of Windows it may want you
to use backslash instead of forward slash there (script\console).
This will load your development application and allow you to interact
with it. It is like running “irb” (the interactive Ruby environment)
with your Rails application already loaded.
You can then run any command which accesses your models. For example,
you can run:
@chop = Chop.find(567, :include => [:song])
and it will extract this item from the database. After each command is
run, the value of the command is displayed. If you just enter a
variable name, it will display its value, etc.
There’s a lot more you can do, too, as you have access to the routing
engine to see how URLs are mapped, etc and much more, but to start with
it is very useful to play with your models and see how they are working.
Any database access will be logged in your log file.
Use “quit” (or Ctrl-D) to exit.
Your error message indicates that at some point you have the String
“chop” which Rails is trying to generate methods for. If you enter the
following at the console:
you will see what Rails is trying to do when executing the line:
@chop.views = @chop.views.next
It should give you some good clues to the actual problem.