I have a controller and a view (ctrler)
controller
def index
...
end
def show
@text = params[:text]
end
end
View (show.html.erb)
<%=@text %>
routes.rb
resources :ctrler
match 'ctrler/:text' => 'ctrler#show'
If I fire the rails s server up and load up http://localhost:3000/ctrler/hiiiiiii I get nothing but if I load http://localhost:3000/ctrler?text=hiiiiii I get text!
Im still trying to get the hang of rails I’m used toPHP but can someone give me some guidance here am I on the right track or have I missed something out?
creates the following rule
This route conflicts with
In the event of a conflict, the rule that appears first takes precedence, so when you go to ‘ctrlr/hiiiii’, it is setting the id parameter to hiiiii, not the text parameter. Try to change routes.rb to
and see if that helps.