I have been going through this railscast but can't seem to get the search results to actually display. When I click on the search button, the log shows that it is doing the search, but the only thing that appears on the view is the heading for the Show page (Search Results). The partial for searches (_product.htlm.erb) does not appear to even be accessed.
Another usage tip. To make creates work (e.g. when using accepts_nested_attributes_for), you'll need serialize :properties, ActiveRecord::Coders::Hstore in your model (assuming your hstore field is called "properties").
I've seen suggestions that this need will go away with Rails 4.0.
Thanks Ryan, I was wondering if you guys know why I keep getting a: "CreditCard is not defined" error? Even after following your tutorial word for word.
I agree with this 100%. While I'm sure many will find Devise great (and Ryan's screen cast to back it up), I myself find that authentication is so easy in Rails that I just don't need Devise.
And the has_secure_password works great.
lol. On a different note...anyone here ever do the same time with Spring and Java? OMG what a chore.
yes, you are quite right. the version numbers where transposed. sorry about that That version supports a considerable amount of the ECMA-376 specification - also known as office open xml. what did you use to generate your data that opened raw xml? I think you'll find axlsx to actually work. we've been sucessful in interop with Numbers and LibreOffice and expect to release google docs operability this week.
Hi! I have the following problem: When I navigate across the site my locale changes to default. For Example when I am on index page and hit wookie and then go to another page my locale changes back to :en. I just can't get why?
As of the latest (07/07/2012) version of minitest-rails you don't need to create an Integration class and register it with MiniTest::Spec.
If you want to use Rails routing and/or Capybara matchers, you still need to include them. Like so:
ruby
ClassMiniTest::Rails::ActionDispatch::IntegrationTest
include Rails.application.routes.url_helpers
include Capybara::DSL
include Capybara::RSpecMatchersend
blowmage also has a minitest-rails-capybara that obviates the need to even do the above. However, I haven't been able to get it to work as of yet. It was only released today, so there's no point in being too picky :)
Don't bother trying to run Rails on Windows. I spent a few days trying to get it to work, and it just doesn't. It takes 10 minutes for Rails to start, and many gems don't work.
If you are new to Rails, trying to use Windows makes it much harder. And Rails is hard enough.
I installed Ubuntu (which can run on the same machine) which works well for Rails. Or, find an old machine and run Ubuntu on it. I ended up using sharing the source folder and using Notepad++ on my regular dev machine which works well.
The only real improvement is to get a Mac and run TextMate. But this solution is 90% there.
Michael, will_filter is awesome, the biggest challege i face is when i try to use it with decimal data type. Could you pliz try and add a decimal container for it. It will be really nyce.
Thanks a lot
I am the author of jasminerice ( bias warning ). I just read of the evergreen docs. The difference seems to be that jasminerice is integrated for Ruby on Rails. If you are already using rails then jasminerice is probably what you want. If you are using javascript with something else or distributing javascript packages standalone then perhaps evergreen is for you.
I have to agree with Andy. I have had to fight Devise a lot more than I would like to and therefore, I tried Sorcery for my current project. So far, it is working out great and it stays out of my way when I don't need it. Ryan has a screencast on it. Check it out.
Every time I've tried Devise, I've run into some sort of use-case that it doesn't handle. My typical workflow was to waste lots of time trying to configure Devise to fit my app, then rip it out.
Now I do authentication from scratch every time.
For me, lower-level abstractions like 'has_secure_password' work perfectly. Devise not so much.
Hello, I have to clone the image which I have created previously. I am just copying the data present at the image column into my cloned deal image column but this didn't displaying any image. The code is as follows:
I'm running into the same problem - getting the mass assignment error. I have tried to comment out that line and restarted the rails server but I still get the error. The new O'Reilly learning rails book also follows this strategy and I get the same error.
How do you make it so when they edit their profile they don't need to put in their password to save changes? I have tried looking around to no avail for some time.
SpreadsheetML file sizes will be about 3-4 times larger than native XLS files. Not really a problem for small files, but with large data sets this could eat up your system resources to generate the file.
SpreadsheetML will only be readable by Microsoft Office. Other mainstream office suites will open it as an XML document.
The CSV approach fits my needs 9 times out of 10. However if you require a native Excel format, please use a gem and avoid using the SpreadsheetML method.
He creates a render_csv method in the application controller that adds headers to the response that use either the user supplied filename or defaults to the action name
For example, this produces a file called 'myfile.csv'
ruby
respond_to do |format|
format.html
format.csv {
render_csv('myfile')
}
end
I've been getting this error when trying to run the cap rubber:create_staging command. It runs for 20 minutes or so successfully, but breaks when it gets here:
In the ASCIIcast version, when you clear out the tbody section, you have two opening tbody tags. I think you want one opening and one closing. Thanks for the great examples!
I have been going through this railscast but can't seem to get the search results to actually display. When I click on the search button, the log shows that it is doing the search, but the only thing that appears on the view is the heading for the Show page (Search Results). The partial for searches (_product.htlm.erb) does not appear to even be accessed.
Any ideas?
solved
How did you make the HTML entities appear? I'm guessing you didn't used simple_format.
+1
i need it..
For my app, my models are Feature instead of Book, Tag instead of Author and Tagging instead of Authorship.
I must have made a mistake:
I'm getting an error NameError in FeaturesController#create of
uninitialized constant Feature::Tagging
and under the trace:
app/models/feature.rb:33:in
tag_tokens='`app/controllers/features_controller.rb:66:in
create'`Has anyone else made this mistake?
Thank you,
Doug
Another usage tip. To make creates work (e.g. when using accepts_nested_attributes_for), you'll need
serialize :properties, ActiveRecord::Coders::Hstore
in your model (assuming your hstore field is called "properties").I've seen suggestions that this need will go away with Rails 4.0.
btw it happens only with the resources path like this. when I visit post views
Thanks Ryan, I was wondering if you guys know why I keep getting a: "CreditCard is not defined" error? Even after following your tutorial word for word.
http://stackoverflow.com/questions/11396650/why-does-jasmine-ruby-not-find-my-js-class
We had the same error described above in a legacy App, but the cause was that the XML is sent with an extension of XLS not XLSX.
Changing the extension to .XLSX solved it for us.
I agree with this 100%. While I'm sure many will find Devise great (and Ryan's screen cast to back it up), I myself find that authentication is so easy in Rails that I just don't need Devise.
And the has_secure_password works great.
lol. On a different note...anyone here ever do the same time with Spring and Java? OMG what a chore.
Great episode! Does anybody know how to set the actions field as mentioned on https://developers.facebook.com/docs/reference/api/post/ when submitting a post to the users feed.
yes, you are quite right. the version numbers where transposed. sorry about that That version supports a considerable amount of the ECMA-376 specification - also known as office open xml. what did you use to generate your data that opened raw xml? I think you'll find axlsx to actually work. we've been sucessful in interop with Numbers and LibreOffice and expect to release google docs operability this week.
Hi! I have the following problem: When I navigate across the site my locale changes to default. For Example when I am on index page and hit wookie and then go to another page my locale changes back to :en. I just can't get why?
my model is:
``` class Post < ActiveRecord::Base
attr_accessible :text, :title
translates :title, :text
validates :title, :presence => true,
:length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
class Translation
attr_accessible :locale
end
end ```
And application controller
``` before_filter :set_locale
private
def set_locale
I18n.locale= params[:locale] if params[:locale].present?
end ```
Thanks in advice!
As of the latest (07/07/2012) version of minitest-rails you don't need to create an Integration class and register it with MiniTest::Spec.
If you want to use Rails routing and/or Capybara matchers, you still need to include them. Like so:
blowmage also has a minitest-rails-capybara that obviates the need to even do the above. However, I haven't been able to get it to work as of yet. It was only released today, so there's no point in being too picky :)
Another option is to use Vagrant, which is what I use when I develop Ruby applications on Windows.
Don't bother trying to run Rails on Windows. I spent a few days trying to get it to work, and it just doesn't. It takes 10 minutes for Rails to start, and many gems don't work.
If you are new to Rails, trying to use Windows makes it much harder. And Rails is hard enough.
I installed Ubuntu (which can run on the same machine) which works well for Rails. Or, find an old machine and run Ubuntu on it. I ended up using sharing the source folder and using Notepad++ on my regular dev machine which works well.
The only real improvement is to get a Mac and run TextMate. But this solution is 90% there.
Solved my own problem, i did not realize that the router acts like a controller and where i called
I should have put the name of my router
I am still having the same issue as stated above
I have set everything to the book, and restarted server several times, any ideas
The repository they have them in does not have the newest version of underscore.
go to the gems location
Ruby1.9.3\lib\ruby\gems\1.9.1\gems\backbone-on-rails-0.9.2.0\vendor\assets\javascripts
replace the underscore.js file with your new one
I'd like to share Unicorn+Nginx configuration with preload_app and optimized deployment scripts: https://gist.github.com/3052776
+1 - this would be very useful
Link for the lazy
In your model you can do something like this
validates_presence_of :password, :on => :create
Michael, will_filter is awesome, the biggest challege i face is when i try to use it with decimal data type. Could you pliz try and add a decimal container for it. It will be really nyce.
Thanks a lot
I am the author of jasminerice ( bias warning ). I just read of the evergreen docs. The difference seems to be that jasminerice is integrated for Ruby on Rails. If you are already using rails then jasminerice is probably what you want. If you are using javascript with something else or distributing javascript packages standalone then perhaps evergreen is for you.
I have to agree with Andy. I have had to fight Devise a lot more than I would like to and therefore, I tried Sorcery for my current project. So far, it is working out great and it stays out of my way when I don't need it. Ryan has a screencast on it. Check it out.
Perhaps what we're getting is just a nice abstraction, and they store things quite differently behind the scenes.
Every time I've tried Devise, I've run into some sort of use-case that it doesn't handle. My typical workflow was to waste lots of time trying to configure Devise to fit my app, then rip it out.
Now I do authentication from scratch every time.
For me, lower-level abstractions like 'has_secure_password' work perfectly. Devise not so much.
Thanks!
Hello, I have to clone the image which I have created previously. I am just copying the data present at the image column into my cloned deal image column but this didn't displaying any image. The code is as follows:
Offer.rb
has_attached_file :image,
:styles => {
:thumb=> "100x100>",
:small => "150x150>",
:medium => "300x300>",
:large => "400x400>"
}
Offer_controller
@deal = Offer.find(params[:id])
@attr = { :nameofdeal => @deal.nameofdeal, :value => @deal.value, :image_file_name => @deal.image,:type => 'image/png'}
@offer = Offer.new(@attr)
Offers/show.html.erb
<% if @offer.image_file_name != nil %>
<%= image_tag @offer.image(:large),:class=>"offer_deal_image" %>
<% end %>
There is a pretty good writeup in the devise wiki: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password
It's straight-forward, and I can confirm it works.
I'm running into the same problem - getting the mass assignment error. I have tried to comment out that line and restarted the rails server but I still get the error. The new O'Reilly learning rails book also follows this strategy and I get the same error.
Is there a step that I'm missing?
How do you make it so when they edit their profile they don't need to put in their password to save changes? I have tried looking around to no avail for some time.
+1
Any one have this working with multiple models? I am trying to create audiences like on facebook, could be users, or groups, or etc.
I have tried polymorphic assoc. and have been banging my head against this for a week.
Thank you Jakub! I was struggling debugging, hard to spot.
hmmmm...I just put up a repo with scripts that run without the needing sudo on the deploy user, but mine aren't gemified.
https://github.com/mcmoyer/chef-istrano
Might have to follow suit and gemify them...that really makes them handy
Hey guys, how can I get the articles using comment object?
Somethin like these:
comment = Comment.all.first comment.article
supposing the first comment has a comentable_type as article.
Thank you for notifying us of that discrepancy, I've corrected the transcripts.
Excel XML is known as SpreadsheetML
FAIR WARNING:
The CSV approach fits my needs 9 times out of 10. However if you require a native Excel format, please use a gem and avoid using the SpreadsheetML method.
Have you solved the problem?
In general I find using a csv view template to be more useful that a to_csv method in a model.
The problem with the view template is that the file will be downloaded with the last component of the URL as the name.
For example from a Show action with a URL like /posts/2.csv you'll get a file called 2.csv, which is not very friendly
Clinton Nixon has a nice solution in this stackoverflow post
http://stackoverflow.com/questions/94502/in-rails-how-to-return-records-as-a-csv-file
He creates a render_csv method in the application controller that adds headers to the response that use either the user supplied filename or defaults to the action name
For example, this produces a file called 'myfile.csv'
Numbers '09 version 2.1 (436) ... should be the latest (did you transpose 1 and 2?)
Hi, I followed the tutorial step by step and I get:
can't convert nil into String error when I click the sign in with facebook link.
I forked the source code and It does not work either.
I get the same error.
How can I solve this?
Is there a way to put ENV variables in a file?
How does the ENV hash work?
I was wondering when someone was going to mention that, and how much weight should be given to the author's advice...
I was wondering when someone was going to mention that, and how much weight should be given to the author's advice...
I've been getting this error when trying to run the cap rubber:create_staging command. It runs for 20 minutes or so successfully, but breaks when it gets here:
executing "cd /mnt/EvrlistSite-production/releases/20120706050602 && bundle exec rake RAILS_ENV=production db:migrate"
servers: ["production.evrlist.com"]
[production.evrlist.com] executing command
** [out :: production.evrlist.com] rake aborted!
** [out :: production.evrlist.com]
** [out :: production.evrlist.com] FATAL: role "EvrlistSite" does not exist
** [out :: production.evrlist.com]
** [out :: production.evrlist.com] Tasks: TOP = > db:migrate
** [out :: production.evrlist.com]
Agree on all!
In the ASCIIcast version, when you clear out the tbody section, you have two opening tbody tags. I think you want one opening and one closing. Thanks for the great examples!