Sexy Forms in Rails - ruby-on-rails

I stumbled across a page describing a plugin - semantic_form_builder (the blog entry was titled "sexy forms"). The plugin was written by Glenn Gillen, with rubypond. Anyhow, when I tried to install the plugin, I got some messages indicating that some of the rake tasks were "deprecated", so I'm guessing the issue is due to the fact I'm using Rails 3 & this was written for an earlier version. Anyone know if this has been updated, converted into a gem or something along those lines?

Related

Rails 4.2 + Ember => unexpected identifier

I'm following Vic Ramon's tutorial. I tried to use the latest version of Rails and Ember-source and I get the following error when visiting home page:
After clicking on link next to error I get this:
How can I fix that?
I ran the following commands:
rails g ember:bootstrap -n App --javascript-engine coffee
rails g ember:install
I removed turbolinks. I also created home controller and an empty view for home#index. Root is set to home#index. Also created following view file:
// app/assets/javascripts/templates/application.js.emblem
h1 Hello World
outlet
Ember gems im using:
Using emblem-source 0.3.18
Using ember-data-source 1.0.0.beta.14.1
Using ember-rails 0.16.1
Using emblem-rails 0.2.2
This could be due to some version incompatibilities between your versions of ember-related gems, as there were quite substantial changes in recent versions of ember (e.g. introduction of HTMLBars, etc.)
Your best bet is to clone the original repo and then try to upgrade individual gems and check if it still works after each upgrade. This way you will be able to identify the troubling gem.
I have verified that the original repo code indeed works with the versions of gems in its current Gemfile.lock.
If you are starting a new Rails + Ember app, ember-cli-rails is probably the way to go, giving you the best of both worlds.
Emblem was the culprit. Replacing .emblem with .handlebars fixed the problem. I tried the tip from emblem-rails git page and icluded
gem "emblem-source", github: "machty/emblem.js"
but that didn't change anything.
I also followed this tutorial (alongside a few others) and I encountered several issues alongside the way ranging from handling templates to setting up the JSON API. I don't see your entire source code so I cannot pinpoint the exact problem. However, it seems that we have similar projects, so you can compare your code to my blog project source code and see what is causing these issues. Comparing to Ramon's tutorial, my blog has implemented everything until chapter 15.
https://github.com/Deovandski/Fakktion/tree/Ember-Rails
If you are a beginner like myself, then I recommend avoiding CoffeeScript and Emblem and sticking to Javascript as much as possible for the first months because you will find more resources and examples. Also, let me know if you need assistance in setting up the project as I used .gitignore to hide things like secrets.yml

What are the new Rails critical security fixes?

I got these updates from rails:
I'd like to announce that 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released. These releases contain two extremely critical security fixes so please update IMMEDIATELY.
link
as it says it's critical. I just updated my application with rails 3.1 to 3.11 and did bundle update rails. My questions are:
What was the actual loophole in rails that has now been fixed?
As a learner I'm eager to understand what the problem was and how has it been fixed. I couldn't get anywhere about this.
Is it really a big loophole, and is there any problem for all Rails application which haven't been updated?
Here's an explanation of the hack : http://charlie.bz/blog/rails-3.2.10-remote-code-execution
And the original post by tenderlove : https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/61bkgvnSGTQ
Basically, anyone can inject XML and instantiate any kind of Ruby object using YAML ... it's complicated, but works on all apps (except the patched one of course, and Rails 1.X) and can even execute system commands ...
Anyone having Rails apps around should already have upgraded ... if not, do it NOW!

Web Services with Ruby

I'm working with the following tutorial:
http://www.ibm.com/developerworks/opensource/library/os-ws-rubyrails/index.html
Everything after step 7 there results in a routing error. I've made sure to gem install actionwebservice; I can't quite figure out how to get this running successfully. I get this:
No route matches [GET] "/hello_message/invoke"
Thoughts? I'm pretty new to rails so I could be overlooking something very trivial here. Thank you for your time.
The tutorial you linked to is dated 2008, and Rails has come a long, long way in the last 6 years. Are you sure you are using the Rails version listed on the article? If you are using version 3+ instead of 2 as listed on the article, all kinds of things could be broken or inaccurate.
Even though it sounds like you have some time in on this project, I think you would be a lot better off going through something more recent like Rails in Action or Agile Web Development with Rails 4th edition, since version 2 is no longer being updated.
http://www.manning.com/katz/
http://pragprog.com/book/rails4/agile-web-development-with-rails

Turn on html_safe for the entire app in Rails 3

Rails 3 turns off the html_safe option by default. I want to revert this thing. I have a rails 2.3.8 app getting converted to rails 3. Almost every page breaks because of the rails3 default html_safe setting. Is there any way I can revert this to where it was in previous versions of rails ? Please help
No, there isn't and even if there is, you shouldn't.
It's a good habit to test (and update) your app using the rails_xss plugin in Rails 2.3.x before actually starting the conversion to Rails 3.
Also, you should have a valid test suite in place so that every error will be spotted by the test suite and you can easily fix it.
Don't try to upgrade unless you have completed these two simple steps. There are also a few other suggestions.
As a side note: Current versions of Rails 3 HTML-escape also non-HTML templates, which is a bug. See: https://rails.lighthouseapp.com/projects/8994/tickets/4858
I'm posting this here, because I found this question while investigating the bug mentioned above, but didn't fine that ticket or anything about this bug on the interwebs. (Bad google skills?) Hope it saves someone time.

Where are the downloadable Rails generators?

When I run...
$ script/generate
I get a list of installed generators and a message saying "More are available at http://wiki.rubyonrails.org/rails/pages/AvailableGenerators." However, the indicated wiki page says "This topic does not exist yet."
Does there exist some central repository of downloadable Rails generators?
In particular, I'd like one that creates the Rails scaffolding, but uses Haml instead of ERB.
It would also be neat if it would generate the Test::Unit tests but using the Shoulda enhancements.
That wiki was a wonderful resource back in the day, but it's long gone. I threw up a archive containing that page from when the wiki started wobbling. It's dated but you can at least see what was there.
As for now, look for gems (especially plugins) to provide the generators rather than expecting them as isolated resources. The gems command can be used to find whats available.
A lot of plugins come with their own generators. The one that springs to mind is restful_authentication because I have used it quite a bit.
Edit: Did you google here?
There's Rails Boost, which is a template generator. In fact, the template you want has already been generated -- that one uses HAML and Shoulda.

Resources