top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to get around a reserved word in Rails?

+1 vote
320 views

I need to use the model name 'Action' (which will not work in Rails 4.0.3) for business reasons (it's a product name). If I name the actual model something else, is there any way to (maybe with mod_rewrite) make the URL appear the way I need it to while keeping everything working in Rails?

I've tried using the controller flag in routes.rb to try to fix this, and it seems to work, but causes a lot of problems elsewhere -- basically anything where I use the automatic URLs, like

 link_to 'Link text', @instance_var

needs to be rewritten to use the long-hand route helper, like this

 link_to 'Link text', action_path(@instance_var)

What am I missing here?

posted Mar 5, 2014 by Naveena Garg

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Namespace it? Product::Action for the model and product_action_path(@instance_var) in the routes.

answer Mar 5, 2014 by Sumit Pokharna
Similar Questions
0 votes

I need to upload files in my rails application.the type of the files should be pdf,xls,word.After that i need to download them from the view page.plz help me in this regard.

+1 vote

In my local machine I had input some data into database using SQLite3 . When I deployed it to heroku why I can't get data that i input?

I'm doing like this

-in Gemfile
group :development do
 gem 'sqlite3'
end
group :production do
 gem 'pg'
 gem 'rails_12factor'
end
-bundle install
-heroku login
-git init 
-git add .
-git commit -m "test"
-git create
-git push heroku master
-heroku run rake db:migrate

How can I get some data when I deployed it to heroku? Please help me.

0 votes

I am getting certificate errors on the https:\rubygems.org web site using 2.1.5 Rails install environment objects.
Any ideas? This is Windows 7 VM machine installation.

...