Hello.
I'm tryes to write webGUI for application's database. This application
uses pre-defined field names, for i.e. "session-timers" and I can't
change its.
In the users.rb writes:
def index
@sipusers=User.all
end
In the index.html.erb:
<% @users.each do |user| %>
<%=h user["session-timers"]%>
<%end%>
It's work fine but servers output:
Exception occurred during reader method compilation.
Maybe session-timers is not a valid Ruby identifier?
/usr/lib64/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:
syntax error, unexpected '-', expecting ';' or '\n'
def session-timers; missing_attribute('se...
^
/usr/lib64/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:
syntax error, unexpected keyword_end, expecting $end
...tributes['session-timers']; end
... ^
Exception occurred during reader method compilation.
Maybe session-timers is not a valid Ruby identifier?
/usr/lib64/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:
syntax error, unexpected '-', expecting ';' or '\n'
def session-timers=(new_value);write_attr...
^
/usr/lib64/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:
syntax error, unexpected keyword_end, expecting $end
...session-timers', new_value);end
... ^
Exception occurred during reader method compilation.
Maybe session-timers is not a valid Ruby identifier?
/usr/lib64/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:
syntax error, unexpected '-', expecting ';' or '\n'
def session-timers?; query_attribute('session-timers'); end
^
/usr/lib64/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:
syntax error, unexpected keyword_end, expecting $end
def session-timers?; query_attribute('session-timers'); end
^
1) How can I remove this errors? Maybe ActiveRecord can create alias for
any name?
2) How can I use helpers (.text_field. .label and etc) for inserting
data from web page?
Thanks for answers.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.