I was trying to create custom view pages in ROR as seen in http://blog.hulihanapplications.com/browse/view/55-ruby-on-rails-multiple-model-form-generator then i got some errors ********************************************** (erb):6:in `template'': compile error (SyntaxError) (erb):3: syntax error, unexpected $undefined ...orm", :locals => {:object => @<%= singular_name ).to_s); _er... ^ (erb):3: syntax error, unexpected ''}'', expecting '')'' ...s); _erbout.concat ", :f => f} %> \n\n<%= link_to ''Show'', @" ^ (erb):5: syntax error, unexpected tIDENTIFIER, expecting '')'' ...out.concat " %> |\n<%= link_to ''Back'', " ^ (erb):6: syntax error, unexpected tIDENTIFIER, expecting '')'' ; _erbout.concat(( plural_name ).to_s); _erbout.concat "_path %>\n" ^ (erb):6: unterminated string meets end of file (erb):6: syntax error, unexpected $end, expecting '')'' ; _erbout ^ My edit page is ********************************************** <h1>Editing <%= singular_name %></h1> <%= render :partial => "_form", :locals => {:object => @<%singular_name %>, :f => f} %> <%%= link_to ''Show'', @<%= singular_name %> %> | <%%= link_to ''Back'', <%= plural_name %>_path %> My partial form "form" is <% for column in object.class.columns %> <% if column.name != "id" %> <div class="field"> <div class="label"> <%= f.label "#{column.name}".to_sym %> </div> <% if column.type == :integer || column.type == :float || column.type == :string %> <% if column.name =~ /_id$/ # is this a id/foreign key field %> <% column_class = column.name.gsub(/_id$/, '''').classify.constantize %> <% if column_class %> <%= collection_select(object.class.name.underscore.to_sym, column.name.to_sym, column_class.all, :id, :name, :prompt => true) %> <% else %> <%= f.text_field column.name.to_sym %> <% end %> <% else %> <%= f.text_field column.name.to_sym %> <% end %> <% elsif column.type == :text %> <%= f.text_area column.name.to_sym %> <% elsif column.type == :datetime %> <%= f.datetime_select column.name.to_sym %> <% elsif column.type == :boolean %> <%= f.check_box column.name.to_sym %> <% else %> <% # Unknown Column Type %> <% end %> </div> <% end %> <% end %> This was the default edit page ********************************************** <h1>Editing <%= singular_name %></h1> <%% form_for(@<%= singular_name %>) do |f| %> <%%= f.error_messages %> <% for attribute in attributes -%> <p> <%%= f.label :<%= attribute.name %> %><br /> <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> </p> <% end -%> <p> <%%= f.submit ''Update'' %> </p> <%% end %> <%%= link_to ''Show'', @<%= singular_name %> %> | <%%= link_to ''Back'', <%= plural_name %>_path %> -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
I was trying to create custom view pages in ROR as seen inhttp://blog.hulihanapplications.com/browse/view/55... <http://blog.hulihanapplications.com/browse/view/55-ruby-on-rails-multiple-model-form-generator> then i got some errors ********************************************** (erb):6:in `template'': compile error (SyntaxError) (erb):3: syntax error, unexpected $undefined ...orm", :locals => {:object => @<%= singular_name ).to_s); _er... ^ (erb):3: syntax error, unexpected ''}'', expecting '')'' ...s); _erbout.concat ", :f => f} %> \n\n<%= link_to ''Show'', @" ^ (erb):5: syntax error, unexpected tIDENTIFIER, expecting '')'' ...out.concat " %> |\n<%= link_to ''Back'', " ^ (erb):6: syntax error, unexpected tIDENTIFIER, expecting '')'' ; _erbout.concat(( plural_name ).to_s); _erbout.concat "_path %>\n" ^ (erb):6: unterminated string meets end of file (erb):6: syntax error, unexpected $end, expecting '')'' ; _erbout ^ My edit page is ********************************************** <h1>Editing <%= singular_name %></h1> <%= render :partial => "_form", :locals => {:object => @<%singular_name %>, :f => f} %> <%%= link_to ''Show'', @<%= singular_name %> %> | <%%= link_to ''Back'', <%= plural_name %>_path %> My partial form "form" is <% for column in object.class.columns %> <% if column.name != "id" %> <div class="field"> <div class="label"> <%= f.label "#{column.name}".to_sym %> </div> <% if column.type == :integer || column.type == :float || column.type == :string %> <% if column.name =~ /_id$/ # is this a id/foreign key field %> <% column_class = column.name.gsub(/_id$/, '''').classify.constantize %> <% if column_class %> <%= collection_select(object.class.name.underscore.to_sym, column.name.to_sym, column_class.all, :id, :name, :prompt => true) %> <% else %> <%= f.text_field column.name.to_sym %> <% end %> <% else %> <%= f.text_field column.name.to_sym %> <% end %> <% elsif column.type == :text %> <%= f.text_area column.name.to_sym %> <% elsif column.type == :datetime %> <%= f.datetime_select column.name.to_sym %> <% elsif column.type == :boolean %> <%= f.check_box column.name.to_sym %> <% else %> <% # Unknown Column Type %> <% end %> </div> <% end %> <% end %> This was the default edit page ********************************************** <h1>Editing <%= singular_name %></h1> <%% form_for(@<%= singular_name %>) do |f| %> <%%= f.error_messages %> <% for attribute in attributes -%> <p> <%%= f.label :<%= attribute.name %> %><br /> <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> </p> <% end -%> <p> <%%= f.submit ''Update'' %> </p> <%% end %> <%%= link_to ''Show'', @<%= singular_name %> %> | <%%= link_to ''Back'', <%= plural_name %>_path %> -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/RBYDUZvJhIoJ. For more options, visit https://groups.google.com/groups/opt_out.
Share your controller code where you are rendering this view. On Tue, Oct 30, 2012 at 3:35 PM, Sreekesh O. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I was trying to create custom view pages in ROR as seen in > > http://blog.hulihanapplications.com/browse/view/55-ruby-on-rails-multiple-model-form-generator > > then i got some errors > ********************************************** > > (erb):6:in `template'': compile error (SyntaxError) > (erb):3: syntax error, unexpected $undefined > ...orm", :locals => {:object => @<%= singular_name ).to_s); _er... > ^ > (erb):3: syntax error, unexpected ''}'', expecting '')'' > ...s); _erbout.concat ", :f => f} %> \n\n<%= link_to ''Show'', @" > ^ > (erb):5: syntax error, unexpected tIDENTIFIER, expecting '')'' > ...out.concat " %> |\n<%= link_to ''Back'', " > ^ > (erb):6: syntax error, unexpected tIDENTIFIER, expecting '')'' > ; _erbout.concat(( plural_name ).to_s); _erbout.concat "_path %>\n" > ^ > (erb):6: unterminated string meets end of file > (erb):6: syntax error, unexpected $end, expecting '')'' > ; _erbout > ^ > > My edit page is > ********************************************** > > <h1>Editing <%= singular_name %></h1> > > <%= render :partial => "_form", :locals => {:object => @<%> singular_name %>, :f => f} %> > > <%%= link_to ''Show'', @<%= singular_name %> %> | > <%%= link_to ''Back'', <%= plural_name %>_path %> > > My partial form "form" is > > <% for column in object.class.columns %> > <% if column.name != "id" %> > <div class="field"> > <div class="label"> > <%= f.label "#{column.name}".to_sym %> > </div> > > <% if column.type == :integer || column.type == :float || > column.type == :string %> > <% if column.name =~ /_id$/ # is this a id/foreign key field %> > <% column_class = column.name.gsub(/_id$/, > '''').classify.constantize %> > <% if column_class %> > <%= collection_select(object.class.name.underscore.to_sym, > column.name.to_sym, column_class.all, :id, :name, :prompt => true) %> > <% else %> > <%= f.text_field column.name.to_sym %> > <% end %> > <% else %> > <%= f.text_field column.name.to_sym %> > <% end %> > <% elsif column.type == :text %> > <%= f.text_area column.name.to_sym %> > <% elsif column.type == :datetime %> > <%= f.datetime_select column.name.to_sym %> > <% elsif column.type == :boolean %> > <%= f.check_box column.name.to_sym %> > <% else %> > <% # Unknown Column Type %> > <% end %> > </div> > <% end %> > <% end %> > > This was the default edit page > ********************************************** > > <h1>Editing <%= singular_name %></h1> > > <%% form_for(@<%= singular_name %>) do |f| %> > <%%= f.error_messages %> > > <% for attribute in attributes -%> > <p> > <%%= f.label :<%= attribute.name %> %><br /> > <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> > </p> > <% end -%> > <p> > <%%= f.submit ''Update'' %> > </p> > <%% end %> > > <%%= link_to ''Show'', @<%= singular_name %> %> | > <%%= link_to ''Back'', <%= plural_name %>_path %> > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Sreekesh O.
2012-Oct-30 10:58 UTC
Re: Error while customizing view template in Ruby on Rails
The controller code for edit view: ****************************************** def edit @<%= file_name %> = <%= class_name %>.find(params[:id]) end -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
KUL KING
2012-Oct-30 11:01 UTC
Re: Re: Error while customizing view template in Ruby on Rails
Where the file_name and class_name are declared? I don''t see them declared inside the edit function. On Tue, Oct 30, 2012 at 3:58 PM, Sreekesh O. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> The controller code for edit view: > ****************************************** > > def edit > @<%= file_name %> = <%= class_name %>.find(params[:id]) > end > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Tommaso Visconti
2012-Oct-30 11:03 UTC
Re: Re: Error while customizing view template in Ruby on Rails
Il 30/10/12 11:58, Sreekesh O. ha scritto:> The controller code for edit view: > ****************************************** > > def edit > @<%= file_name %> = <%= class_name %>.find(params[:id]) > end >You put ERB, which must be in the views, in the controller. This is how the controller should be (pure ruby code): def edit @file_name = class_name.find(params[:id]) end and in the view (edit.html.erb) you can show @file_name in this way: <div> <%= @file_name.some_attribute %> </div> -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jim Ruther Nill
2012-Oct-30 11:05 UTC
Re: Re: Error while customizing view template in Ruby on Rails
On Tue, Oct 30, 2012 at 7:01 PM, KUL KING <kulking370-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Where the file_name and class_name are declared? I don''t see them declared > inside the edit function. > > > On Tue, Oct 30, 2012 at 3:58 PM, Sreekesh O. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> The controller code for edit view: >> ****************************************** >> >> def edit >> @<%= file_name %> = <%= class_name %>.find(params[:id]) >> end >> >you are using erb code inside the controller. i don''t get why you want to do this or if it''s even possible to do it like this. start with the basic tutorials first before you go ahead with what you''re trying to do.> >> -- >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Sreekesh O.
2012-Oct-30 11:10 UTC
Re: Error while customizing view template in Ruby on Rails
These are files in rails installation folder the scaffold-generator template. These are defined default by rails path of files in linux: usr/lib/ruby/gems/1.8/gems/rails 2.3.5/lib/rails-generator/generator/components/scaffold/template -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Sreekesh O.
2012-Oct-30 11:12 UTC
Re: Re: Error while customizing view template in Ruby on Rails
Jim ruther Nill wrote in post #1081968:> On Tue, Oct 30, 2012 at 7:01 PM, KUL KING <kulking370-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> @<%= file_name %> = <%= class_name %>.find(params[:id]) >>> end >>> >> > you are using erb code inside the controller. i don''t get why you want > to > do this or if it''s even > possible to do it like this. start with the basic tutorials first > before > you go ahead with what you''re > trying to do. > > >>> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > --Im doing this cause i want to scaffold new model where i need some properties attached to all scaffolding.. is there any other way to generate scaffolding template where i can manually set some specifications -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.