Hi. I''m trying to run Getting started tutorial under Rails 4.0.0.beta1 although it assumes it runs on Rails 3. I was able to get rid of all errors by wrapping post_params here and there, and installing protected_attributes Gem for attr_accessible to make sense. Post/ comment CRUD works just fine, but I don''t seem to be able to add Tags (the final part of the tutorial). Post saved successfully message appears, but tags aren''t saved as part of saving the post. Database isn''t even UPDATEd unless I change either name, title or content, but tags aren''t persisted in any case. What gives? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
The tutorial: http://guides.rubyonrails.org/getting_started.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 4 May 2013 18:37, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> Hi. I''m trying to run Getting started tutorial under Rails 4.0.0.beta1 > although it assumes it runs on Rails 3. I was able to get rid of all > errors by wrapping post_params here and there, and installing > protected_attributes Gem for attr_accessible to make sense. Post/ > comment CRUD works just fine, but I don''t seem to be able to add Tags > (the final part of the tutorial). Post saved successfully message > appears, but tags aren''t saved as part of saving the post. Database > isn''t even UPDATEd unless I change either name, title or content, but > tags aren''t persisted in any case. What gives?You would be better to stick to Rails 3 (with a Rails 3 tutorial) until you have mastered the basics of Rails and know how to debug your code. If you really must go with Rails 4 then railstutorial.org have a beta tutorial at http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=4.0#top Using a tutorial aimed at a different version of Rails to that which you are using is a doomed enterprise. Colin> > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Thanks for the link. I''m learning Rails in my spare time and have no immediate need for it, so I thought I''d just go ahead and start with version 4. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
This one is Rails 4 specific http://edgeguides.rubyonrails.org/getting_started.html On May 4, 2013, at 1:42 PM, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> The tutorial: http://guides.rubyonrails.org/getting_started.html > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Thanks, Scott, I somehow missed the link to edgeguides.* vs. guides.*. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On May 4, 11:53 pm, Scott Eisenberg <sco...-5XihT3XKyOKakBO8gow8eQ@public.gmane.org> wrote:> This one is Rails 4 specific > > http://edgeguides.rubyonrails.org/getting_started.htmlAlas, in "5.2 The first form" the empty form isn''t shown in new.html.erb. This is all I get after clicking view source in Firefox: <!DOCTYPE html> <html> <head> <title>Blog</title> <link data-turbolinks-track="true" href="/assets/application.css? body=1" media="all" rel="stylesheet" /> <link data-turbolinks-track="true" href="/assets/posts.css?body=1" media="all" rel="stylesheet" /> <link data-turbolinks-track="true" href="/assets/welcome.css?body=1" media="all" rel="stylesheet" /> <script data-turbolinks-track="true" src="/assets/jquery.js? body=1"></script> <script data-turbolinks-track="true" src="/assets/jquery_ujs.js? body=1"></script> <script data-turbolinks-track="true" src="/assets/turbolinks.js? body=1"></script> <script data-turbolinks-track="true" src="/assets/posts.js?body=1"></ script> <script data-turbolinks-track="true" src="/assets/welcome.js?body=1"></ script> <script data-turbolinks-track="true" src="/assets/application.js? body=1"></script> <meta content="authenticity_token" name="csrf-param" /> <meta content="9TL7qWKSPp2+gCFUgstifTB3cyZs/Q2whYQGIXDI5n0=" name="csrf-token" /> </head> <body> </body> </html> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 5 May 2013 16:09, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> On May 4, 11:53 pm, Scott Eisenberg <sco...-5XihT3XKyOKakBO8gow8eQ@public.gmane.org> wrote: >> This one is Rails 4 specific >> >> http://edgeguides.rubyonrails.org/getting_started.html > > Alas, in "5.2 The first form" the empty form isn''t shown in > new.html.erb.Are there any error messages in the server window? Post your app/views/posts/new.html.erb Colin> > This is all I get after clicking view source in Firefox: > > <!DOCTYPE html> > <html> > <head> > <title>Blog</title> > <link data-turbolinks-track="true" href="/assets/application.css? > body=1" media="all" rel="stylesheet" /> > <link data-turbolinks-track="true" href="/assets/posts.css?body=1" > media="all" rel="stylesheet" /> > <link data-turbolinks-track="true" href="/assets/welcome.css?body=1" > media="all" rel="stylesheet" /> > <script data-turbolinks-track="true" src="/assets/jquery.js? > body=1"></script> > <script data-turbolinks-track="true" src="/assets/jquery_ujs.js? > body=1"></script> > <script data-turbolinks-track="true" src="/assets/turbolinks.js? > body=1"></script> > <script data-turbolinks-track="true" src="/assets/posts.js?body=1"></ > script> > <script data-turbolinks-track="true" src="/assets/welcome.js?body=1"></ > script> > <script data-turbolinks-track="true" src="/assets/application.js? > body=1"></script> > <meta content="authenticity_token" name="csrf-param" /> > <meta content="9TL7qWKSPp2+gCFUgstifTB3cyZs/Q2whYQGIXDI5n0=" > name="csrf-token" /> > </head> > <body> > > > > </body> > </html> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 5 May 2013 16:17, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 5 May 2013 16:09, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote: >> On May 4, 11:53 pm, Scott Eisenberg <sco...-5XihT3XKyOKakBO8gow8eQ@public.gmane.org> wrote: >>> This one is Rails 4 specific >>> >>> http://edgeguides.rubyonrails.org/getting_started.html >> >> Alas, in "5.2 The first form" the empty form isn''t shown in >> new.html.erb. > > Are there any error messages in the server window? > > Post your app/views/posts/new.html.erbAlso look in log/development.log and see if there are any clues. Take a bit of time to understand what you are seeing there. Colin> > Colin > >> >> This is all I get after clicking view source in Firefox: >> >> <!DOCTYPE html> >> <html> >> <head> >> <title>Blog</title> >> <link data-turbolinks-track="true" href="/assets/application.css? >> body=1" media="all" rel="stylesheet" /> >> <link data-turbolinks-track="true" href="/assets/posts.css?body=1" >> media="all" rel="stylesheet" /> >> <link data-turbolinks-track="true" href="/assets/welcome.css?body=1" >> media="all" rel="stylesheet" /> >> <script data-turbolinks-track="true" src="/assets/jquery.js? >> body=1"></script> >> <script data-turbolinks-track="true" src="/assets/jquery_ujs.js? >> body=1"></script> >> <script data-turbolinks-track="true" src="/assets/turbolinks.js? >> body=1"></script> >> <script data-turbolinks-track="true" src="/assets/posts.js?body=1"></ >> script> >> <script data-turbolinks-track="true" src="/assets/welcome.js?body=1"></ >> script> >> <script data-turbolinks-track="true" src="/assets/application.js? >> body=1"></script> >> <meta content="authenticity_token" name="csrf-param" /> >> <meta content="9TL7qWKSPp2+gCFUgstifTB3cyZs/Q2whYQGIXDI5n0=" >> name="csrf-token" /> >> </head> >> <body> >> >> >> >> </body> >> </html> >> >> -- >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hi, Colin, no errors in the "rails server" window: Started GET "/posts/new" for 192.168.0.1 at 2013-05-05 20:23:21 +0500 Processing by PostsController#new as HTML Rendered posts/new.html.erb within layouts/application (11.6ms) Completed 200 OK in 34ms (Views: 31.2ms | ActiveRecord: 0.0ms) (and a few more "Started GET /assets/*" lines) Absolutely same lines in development.log as in server''s output window. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
new.html.erb copied from the tutorial as is: <% form_for :post, url: posts_path do |f| %> <p> <%= f.label :title %><br> <%= f.text_field :title %> </p> <p> <%= f.label :text %><br> <%= f.text_area :text %> </p> <p> <%= f.submit %> </p> <% end %> I can put <%= "hi" %> before or after form_for, and see it. But not inside form_for - then I won''t see it. Probably because :post is nonexistent it doesn''t get rendered at all. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 5 May 2013 16:28, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> new.html.erb copied from the tutorial as is: > <% form_for :post, url: posts_path do |f| %> > <p> > <%= f.label :title %><br> > <%= f.text_field :title %> > </p> > > <p> > <%= f.label :text %><br> > <%= f.text_area :text %> > </p> > > <p> > <%= f.submit %> > </p> > <% end %> > > I can put <%= "hi" %> before or after form_for, and see it. But not > inside form_for - then I won''t see it. Probably because :post is > nonexistent it doesn''t get rendered at all.It seems a bit odd doing this before the model has been generated and the database migrated. I am a bit dubious about whether this guide works as shown. I suggest trying the one at railstutorial.org that I mentioned earlier. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Thanks, will do that for now. I just thought the guides hosted on rubyonrails.org were more "official" and up-to-date. Well, they weren''t. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On May 5, 2013, at 12:15 PM, rihad wrote:> Thanks, will do that for now. I just thought the guides hosted on > rubyonrails.org were more "official" and up-to-date. Well, they > weren''t.They are official for 3.2, which is "stable" until 4.0 clears release candidate stage. I am glad to see you are trying the new hotness, that''s how the bugs get found! Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Sun, May 5, 2013 at 8:28 AM, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> new.html.erb copied from the tutorial as is: > <% form_for :post, url: posts_path do |f| %>Then the tutorial is in error: you need <%= form_for ... -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 5 May 2013 17:33, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, May 5, 2013 at 8:28 AM, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote: >> new.html.erb copied from the tutorial as is: >> <% form_for :post, url: posts_path do |f| %> > > Then the tutorial is in error: you need <%= form_for ...Well spotted, I missed that one. The tutorial does have <%= in fact. It appears to be the copying that is in error. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On May 5, 9:33 pm, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, May 5, 2013 at 8:28 AM, rihad <ri...-JGs/UdohzUI@public.gmane.org> wrote: > > new.html.erb copied from the tutorial as is: > > <% form_for :post, url: posts_path do |f| %> > > Then the tutorial is in error: you need <%= form_for ... >Woops, sorry, guys, I read somewhere that it''s better to retype code than just copy&paste it, poor me :( -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
This time there does seem to be an obsoleted part not in sync with latest code on http://edgeguides.rubyonrails.org/getting_started.html 5.6 Saving data in the controller @post = Post.new(params[:post]) triggers the exception ActiveModel::ForbiddenAttributesError in PostsController#create the line should instead be @post = Post.new(params.require(:post).permit(:title, :text)) or something to that effect. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
p.s. I wonder if this repetitiveness is needed here. For the simple case such as Post.new(params[:post]), I guess Rails should just "know" what fields comprise a model and permit relevant safe fields coming from POSTed data. Of course one can always override that with the second permit variant, but not be forced to do so, introducing possibility for error (dreaded DRY). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 5 May 2013 19:33, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> p.s. I wonder if this repetitiveness is needed here. For the simple > case such as Post.new(params[:post]), I guess Rails should just "know" > what fields comprise a model and permit relevant safe fields coming > from POSTed data. Of course one can always override that with the > second permit variant, but not be forced to do so, introducing > possibility for error (dreaded DRY).I believe you can still use attr_accessible in the model if you want to. This feature is a change for Rails 4 that gives greater flexibility in that it allows permitting or require parameters from within the controller. Why would it not be DRY? By the way, could you not top post please, it makes it difficult to follow the thread. Insert your replies inline at appropriate points in the previous message. Thanks. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hi, Colin, you see, I think that listing permitted fields all over again in the controller can be viewed as repetitiveness. Ideally, model would just accept the bulk of fields coming from the outside, validate their presence + conformance, and yell if it isn''t the case. How it is being done now ensures greater flexibility in that controller can massage + glue up several fields into one etc. before passing them all to the model. This is good, and I''m not saying this functionality shouldn''t be available, but in the simplest case, Post.save(params[:post]) should just do the obvious by adhering to convention over configuration. Just my opinion. p.s. I don''t believe I''ve top-posted in this thread? Well, unless you believe that a few of my quote-less posts, such as this one, are top- posting. I simply click "reply" under relevant post. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 6 May 2013 05:53, rihad <rihad-JGs/UdohzUI@public.gmane.org> wrote:> Hi, Colin, you see, I think that listing permitted fields all over > again in the controller can be viewed as repetitiveness.There is no repetition as this is not listing the fields "all over again". This is just specifying which fields may (or must) be mass assigned.> Ideally, > model would just accept the bulk of fields coming from the outside, > validate their presence + conformance, and yell if it isn''t the case. > How it is being done now ensures greater flexibility in that > controller can massage + glue up several fields into one etc. before > passing them all to the model. This is good, and I''m not saying this > functionality shouldn''t be available, but in the simplest case, > Post.save(params[:post]) should just do the obvious by adhering to > convention over configuration. Just my opinion.It was like that in rails originally I believe, but it is just too dangerous. It was too easy for the developer to forget to protect the fields that should not be mass assigned.> > p.s. I don''t believe I''ve top-posted in this thread? Well, unless you > believe that a few of my quote-less posts, such as this one, are top- > posting. I simply click "reply" under relevant post.You are right, I assumed that you had top posted as it was at the top. Rather you had committed the (arguably) even worse sin of not quoting the relevant parts of previous message. This means that your latest message, for example, has no context so one has to look back through previous emails to find out what it is about. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.