Rails 4 and form authenticity

144 views
Skip to first unread message

John Lane

unread,
Oct 2, 2013, 7:07:22 AM10/2/13
to cells-an...@googlegroups.com
Hi Nick, I have been following through the tutorial using a Rails 4 system. (now using the gem version 1.2.4). All was going well until I hit the transition from using form_tag to using form_for. This throws us into the major rails 4 change around model validation and I have not been able to get it to work.

The first problem is that the form is missing a now-required authenticity token. I can manually add this using "= token_tag form_authenticity_token" in the form.haml but I would have assumed this would be 'hidden magic' as it is with form_for in a standard view.

I next hit the strong parameter requirement of rails 4. I am going to take a look at that next but, in the meantime, I tried adding the ' protected_attributes' gem but the AJAX then broke (my screen contents being replaced with raw "Query("#twitter").replaceWith("<div id=\"twitter\"><ul>\..." ).

Admittedly I am new to rails 4 as well and I haven't spent long on this but I thought I'd mention this hurdle in case I am misssing something obvious. I'd like to be able to run through the tutorial end-to-end on Rails 4 if I can.

Many thanks,
John.



Nick Sutterer

unread,
Oct 2, 2013, 7:09:22 AM10/2/13
to cells-an...@googlegroups.com
John, sorry again. The main problem is the tutorial hasn't been revised in a long time. Uploading your tutorial to github could help debugging. Also, we need to rewrite that tutorial in the near future.


--
Sie erhalten diese Nachricht, weil Sie Mitglied der Google Groups-Gruppe "Cells and Apotomo" sind.
Um Ihr Abonnement für diese Gruppe zu beenden und keine E-Mails mehr von dieser Gruppe zu erhalten, senden Sie eine Email an cells-and-apot...@googlegroups.com.
Weitere Optionen: https://groups.google.com/groups/opt_out

John Lane

unread,
Oct 2, 2013, 3:36:37 PM10/2/13
to cells-an...@googlegroups.com
Ok, so I've been getting on OK. I have it working under Rails 4 as far as "namespacing". I've pushed my code to GitHub, it's at https://github.com/johnlane/apotomo-example. There's a transcript file at the root that lists what I did. I will try to continue working through it tomorrow and update the repo with any changes. So far, looking good...

John


John Lane

unread,
Oct 3, 2013, 6:16:27 AM10/3/13
to cells-an...@googlegroups.com
Well I've got as far as message passing (part 7) and everything's working and on GitHub. I'm stuck on the next section "composed widgets" because I don't have the full code for "app/widgets/twitter_widget.rb" (file got removed back when I did the namespacing work). The GitHub link on the tutorial page is 404 so I tried looking in your repo "apotomo_peters_guide" but I think that's out of date (different file structure for one).

Do you have the code that you can stick on GitHub or gist it or send it to me some other way? I'm otherwise feeling quite confident I can get to the end of the tutorial and have a full Rails 4 working version.



Nick Sutterer

unread,
Oct 3, 2013, 9:37:43 AM10/3/13
to cells-an...@googlegroups.com
I'll give it a go here locally, thanks for your repo.


On Thu, Oct 3, 2013 at 12:16 PM, John Lane <goo...@jelmail.com> wrote:
Well I've got as far as message passing (part 7) and everything's working and on GitHub. I'm stuck on the next section "composed widgets" because I don't have the full code for "app/widgets/twitter_widget.rb" (file got removed back when I did the namespacing work). The GitHub link on the tutorial page is 404 so I tried looking in your repo "apotomo_peters_guide" but I think that's out of date (different file structure for one).

Do you have the code that you can stick on GitHub or gist it or send it to me some other way? I'm otherwise feeling quite confident I can get to the end of the tutorial and have a full Rails 4 working version.



John (Google)

unread,
Oct 9, 2013, 4:27:52 AM10/9/13
to cells-an...@googlegroups.com
Nick, Just checking if you were able to progress this at all...?
happy to help by testing, etc.
John

Nick Sutterer

unread,
Oct 9, 2013, 7:45:07 PM10/9/13
to cells-an...@googlegroups.com
Totally forgot about it :) Cloned it

Nick Sutterer

unread,
Oct 15, 2013, 11:33:33 PM10/15/13
to cells-an...@googlegroups.com
Hey John, when I run your app the stylesheets don't work. Is that intentionally?

John (Google)

unread,
Oct 16, 2013, 6:55:09 AM10/16/13
to cells-an...@googlegroups.com
Hi Nick, yes it's as expected - I was focussing on the functionality. I never did the stylesheets...

John Lane

unread,
Oct 25, 2013, 6:42:18 AM10/25/13
to cells-an...@googlegroups.com
Hello Nick, just wondered if you had a chance to look at thr tutorial at rails 4 or can you make availble the latest code-base so I can continue working through it...? thanks, john.
Message has been deleted

Nick Sutterer

unread,
Oct 25, 2013, 8:14:28 PM10/25/13
to cells-an...@googlegroups.com
I went through it and ran your main branch but I couldn't find the place where the drag&drop stuff is implemented, where we actually need the form.


2013/10/25 John Lane <goo...@jelmail.com>
Hi nick did you get a chance to look at the tutorial in rails4 following my work on github, or could you make the last code base for the tutorial available so I can continue working through it? thanks, john.
Reply all
Reply to author
Forward
0 new messages