Note that NULL for the name value. I use as valid string but there is
goes as NULL.
Do another scaffold named act and everything goes fine with no changes.
I could imagine that action is a reserved word but shouldn't it complain
about it?
What params are showing in your log? What's the controller code that
creates the record? You've provided us with no information that we can
use to help.
Note that NULL for the name value. I use as valid string but there is
goes as NULL.
Do another scaffold named act and everything goes fine with no changes.
I could imagine that action is a reserved word but shouldn't it complain
about it?
Do another scaffold named act and everything goes fine with no changes.
I could imagine that action is a reserved word but shouldn't it complain
about it?
Any hints?
I'd imagine that your use of a reserved word has caused the issue, so
don't.
I am admittedly curious... (but too lazy to spin up my VM at the
moment).
What does the log show for the POSTed values?
Unless you are willing to do the delving into the rails codebase, this
is one of those simple "Don't do that" cases.
Do another scaffold named act and everything goes fine with no changes.
I could imagine that action is a reserved word but shouldn't it complain
about it?
Any hints?
I'd imagine that your use of a reserved word has caused the issue, so
don't.
I'd be surprised if "action" is reserved.
I am admittedly curious... (but too lazy to spin up my VM at the
moment).
What does the log show for the POSTed values?
Unless you are willing to do the delving into the rails codebase, this
is one of those simple "Don't do that" cases.
Not necessarily. There's not enough information yet to jump to that
conclusion.
Of course I could paste all the code here. This uses the generated code
by the scaffold generator. I haven't changed a single line. Anyway, the
main involved action is the create:
# POST /actions
# POST /actions.xml
def create
@action = Action.new(params[:action])
respond_to do |format|
if @action.save
format.html { redirect_to(@action, :notice => 'Action was
successfully created.') }
format.xml { render :xml => @action, :status => :created,
:location => @action }
else
format.html { render :action => "new" }
format.xml { render :xml => @action.errors, :status =>
:unprocessable_entity }
end
end
end
Data from the view form:
<%= form_for(@action) do |f| %>
<% if @action.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@action.errors.count, "error") %> prohibited
this action from being saved:</h2>
<ul>
<% @action.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
Started GET "/actions/new" for 127.0.0.1 at 2010-11-17 16:23:47 +0100
Processing by ActionsController#new as HTML
Rendered actions/_form.html.erb (8.5ms)
Rendered actions/new.html.erb within layouts/application (11.8ms)
Completed 200 OK in 23ms (Views: 15.4ms | ActiveRecord: 0.0ms)
Started POST "/actions" for 127.0.0.1 at 2010-11-17 16:23:53 +0100
Processing by ActionsController#create as HTML
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"3uHroG5clvDouL8poeQKErZNEBlCA5s+Row3HXp8lEw=",
"commit"=>"Create Action"}
SQL (0.6ms) BEGIN
SQL (1.1ms) describe `actions`
SQL (0.3ms) INSERT INTO `actions` (`created_at`, `name`,
`updated_at`) VALUES ('2010-11-17 15:23:53', NULL, '2010-11-17
15:23:53')
SQL (0.7ms) COMMIT
Redirected to http://127.0.0.1:3001/actions/1
Completed 302 Found in 61ms
Yeah, might be a don't do that
But usually it complain and doesn't let you move on with reserved words
so I was also curious. Also lazy to go deep since i can pick any other
name and it goes ok.
Note that NULL for the name value. I use as valid string but there is
goes as NULL.
Do another scaffold named act and everything goes fine with no changes.
I could imagine that action is a reserved word but shouldn't it complain
about it?
Note that NULL for the name value. I use as valid string but there is
goes as NULL.
Do another scaffold named act and everything goes fine with no changes.
I could imagine that action is a reserved word but shouldn't it complain
about it?
action overwritten by Rails when used with form parameters (i.e. an
ActionsController expecting action[field_name] won't work)
Yes, I realized this just after posting. I couldn't see why `action` as
a field or Action as an object name would be reserved, but I didn't take
into consideration that Rails uses a parameter in the request with the
same name as the object class. If that class is Action, then yes, bad
things happen.
I fell over this one myself a little time ago. I ended up with Act
model also.