+1 for same problem.
Not only when rails s running, but also any programs like vim. If I hit cmd + t when inside vim, the new tab is at home directory.
Sorry I have been away for a few days. I can display the table OK with pagination etc but still have the few issues mentioned above, including that I cannot sort or search the table. I intend to re-visit those problems later.
I have added some code to enable the user to select a row by clicking and render the appropriate view. The controller gets the correct id and the log shows the view as being rendered, but it does not show in the browser. I am working on that at present.
I know it has been several months, but I get the same msg but doesn't seem to hurt anything in production. I'd just like to stop if from annoying me every time I do a rails s or c. Any progress on the issue?
Just a little update about using whenever with capistrano.
Now you don't need to create a task. You can just add this in your deploy.rb : set :whenever_command, "bundle exec whenever"
set :whenever_environment, defer { stage }
require "whenever/capistrano"
If you look at the github of Whenever, it is explained.
Thank you Ryan. After struggling for a few days with Linode/Debian6/rvm/capistrano/passenger/enginx I gave up and followed this screencast to success in a couple of hours. I decided to follow exactly so my stack is the same as yours. I am sure I was doing terrible things with rvm. My brain isn't quite as large as Wayne's and rvm does a lot of magic with system commands such as cd. Even rvm implode didn't seem to uninstall without side effects. Hence the reinstall of the OS. I think rvm is powerful & useful and would love to see an in depth railscast on it.
I just came across this issue. It is as you expected: object.send(association) does not work the same way for has_one as it does for has_many. To get around this, I changed the link_to_add_fields helper as follows:
ruby
deflink_to_add_fields(name, f, association)
new_object = f.object.class.reflect_on_association(association).klass.new
id = new_object.object_id
fields = f.fields_for(association, new_object, child_index: id) do |builder|
render(association.to_s.pluralize + "/fields", f: builder)
end
link_to(name, '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
end
Basically, I changed f.object.send(association).klass to f.object.class.reflect_on_association(association).klass and, since I use users/_fields.html.erb instead of user_fields.html.erb, I also changed the render line. Hope this helps, if you're still having that problem. If not, hope this helps some other lost soul of the future.
I used Google's URL shortener (@ http://goo.gl/ ) - simply set the address given by your URL-shortener of choice as the value of "Website: " under "Application Details".
Done and done.
PS!: Ryan didn't explicitly say this, but to use the ENV['TWITTER_SECRET'] etc you can set these values under environments/{development.rb,production.rb} like so:
I would like to do a very similar thing with DataTables. Have you made any progress in how to display data from associated tables using server side processing?
This is great! But I am having a bit of an issue. I can not seem to get it to bypass the password as easily as it should be.
I am allowing login via facebook using the information from this railscasts. My resource is :subscriber instead of :user, but the rest is pretty much the same.
ruby
classOmniauthCallbacksController < Devise::OmniauthCallbacksControllerdefall
subscriber = Subscriber.from_omniauth(request.env["omniauth.auth"])
if subscriber.persisted?
sign_in_and_redirect subscriber, notice:"Signed in!"else
.....the rest of what you see in the railscasts
and my model contains:
ruby
# populates db with information from omniauth'ed subscriber(facebook) defself.from_omniauth(auth)
where(auth.slice(:provider, :uid)).first_or_create do |subscriber|
subscriber.provider = auth.provider
subscriber.uid = auth.uid
subscriber.email = auth.info.email
subscriber.firstname = auth.info.first_name
subscriber.lastname = auth.info.last_name
endend# persists subscriber information through the session # when omniauth'ed subscriber (facebook) defself.new_with_session(params, session)
if session["devise.subscriber_attributes"]
new(session["devise.subscriber_attributes"], without_protection:true) do |subscriber|
subscriber.attributes = params
subscriber.valid?
endelsesuperendenddefpassword_required?super && provider.blank?
end
When I run debugger and interject immediately before subscriber.persisted? I can see I have a provider and a uid for subscriber, but subscriber.persisted? returns false because subscriber.new_record? is true.
maybe a bit off subject but i am using omniauth to collect linked in profile data and am a bit stuck when it comes to getting info outside the - raise request.env["omniauth.auth"].to_yaml
I am trying to gain as much info as possible about signed in users such as past positions and location
I have integrate this tutorial with my ROR
application but i am facing a problem in logout
when i login with my facebook account to my
application its working but when i logout
it only logout on my application not form facebook.
I have to logout manually on facebook.
please help me out.
I was actually looking for a solution how to eagerly-load if the user voted on the answer, so that I can display a list of answers and tell if the user voted on them without doing the additional query.
I guess this could be done with some joins, but I wasn't able to do it with the activerecord-reputation-system.
Unfortunately it seems to be impossible to set up Sunspot and Solr on Windows. Running rake sunspot:solr:run works fine, however, when trying to reindex or if on server development mode and perform the search method, you get the exception "No connection could be made because the target machine actively refused it. - connect(2)". I installed sunspot_rails and sunspot_solr today, so it should be the latest versions. Updated java as well today to 1.7.0_05. Now, here some people get it working by changing line 104 in server.rb from exec(Shellwords.shelljoin(command)) to system(Shellwords.shelljoin(command)), but this doesn't work for me either. I don't really see any possible solution left to try. Does anybody have an idea how to get it work on windows 7?
Has anyone seen how to do associated_against with UUIDs? I am getting this error.
PG::Error: ERROR: operator does not exist: uuid = character varying
LINE 1: ...M "articles" INNER JOIN "forums" ON "forums"."id" = "article...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Just wanted to mention that in the Mongo Shell you can use .pretty() at the end of your query, so you can get the pretty-printed output in mongo shell. This is similar to what you would get with "awesome_print" in irb or the rails console.
I've got my app setup to have multiple organizations, and multiple pages per organization (identified via the subdomain). Is it possible to have FriendlyId check for uniqueness only on a per-user basis?
Thus that there can be multiple /home pages, but are unique within a given organization.
+1 for same problem.
Not only when rails s running, but also any programs like vim. If I hit cmd + t when inside vim, the new tab is at home directory.
Rick,
Sorry I have been away for a few days. I can display the table OK with pagination etc but still have the few issues mentioned above, including that I cannot sort or search the table. I intend to re-visit those problems later.
I have added some code to enable the user to select a row by clicking and render the appropriate view. The controller gets the correct id and the log shows the view as being rendered, but it does not show in the browser. I am working on that at present.
John
Client_Side_Validations didn't work "out of the box" with simple_form for me.
Read this helpful post: http://www.ddarrensmith.com/blog/2012/05/17/ruby-on-rails-client-side-validation-with-validation-helpers-and-twitter-bootstrap/
And get this gist to make it work: https://gist.github.com/2705324#file_client_side_validations_twitter_boostrap_simple_form.js
Whenever I use the JS/Coffee code to log in using a pop-up I got:
Turns out this is due to a bug in omniauth-facebook 1.4.1 -- downgrading to 1.4.0 made it work.
Also, instead of hardcoding the path in the coffee file, I used:
Perhaps a little unwieldy - and I'd like to know a shorter way of doing this, but it works.
The above is akin to calling
user_omniauth_callback_path(:facebook)
In views etc.
PS ! Found out about the error from:
Link
I know it has been several months, but I get the same msg but doesn't seem to hurt anything in production. I'd just like to stop if from annoying me every time I do a rails s or c. Any progress on the issue?
Awesome, simply awesome.
Great episode! The only problem I have is dealing with many-to-many relations – sadly that doesn't seem to work so well with rails.
hi,
thanks for the great cast.
I'm having this error:
undefined method `authenticates_with_sorcery!' for User:Class
this happens on my new app on rails 3.2.6 using the latest version of mongoid (episode #238)
looks like there was a known error with mongowrapper, maybe is this linked?
Any help would appreciated.
thanks
Just a little update about using whenever with capistrano.
Now you don't need to create a task. You can just add this in your deploy.rb :
set :whenever_command, "bundle exec whenever"
set :whenever_environment, defer { stage }
require "whenever/capistrano"
If you look at the github of Whenever, it is explained.
Hey, I keep getting these error on everything I try to do, products index, show and when I try to save a product. Any ideas ?
I get the same thing. Followed the examples as well.
I'm on Debian Squeeze though.
Thanks for the wonderful gem!
Ruby 1.9.2p290, Rails 3.2.7, Windows 7 here.
Shows load times but the SQL column is empty.
The dev database is on sqlite.
Great Railscast! I've always used Heroku. Is there an equivalent command to 'heroku logs' on VPS with Nginx?
Thanks!
bundle exec brakeman
Anybody has any tips on how to seed the database with the translations?
More applications of Redis: Obie at RailsConf
Thank you Ryan. After struggling for a few days with Linode/Debian6/rvm/capistrano/passenger/enginx I gave up and followed this screencast to success in a couple of hours. I decided to follow exactly so my stack is the same as yours. I am sure I was doing terrible things with rvm. My brain isn't quite as large as Wayne's and rvm does a lot of magic with system commands such as cd. Even rvm implode didn't seem to uninstall without side effects. Hence the reinstall of the OS. I think rvm is powerful & useful and would love to see an in depth railscast on it.
With activerecord-reputation-system 1.3.0,
You can use evaluated_by method to do this.
e.g.
will return all Haiku instances that are evaluated by @user.
Can you post how you managed to do this on pastebin or upload source to github ? I want to able able to associate multiple accounts but am kinda lost.
Good point (re: remember me from multiple machines).
controller:
View:
I just came across this issue. It is as you expected: object.send(association) does not work the same way for has_one as it does for has_many. To get around this, I changed the link_to_add_fields helper as follows:
Basically, I changed
f.object.send(association).klass
tof.object.class.reflect_on_association(association).klass
and, since I use users/_fields.html.erb instead of user_fields.html.erb, I also changed the render line. Hope this helps, if you're still having that problem. If not, hope this helps some other lost soul of the future.-Christian B.
Getting 401 when clicking your twitter authentication link ?
You're probably developing on localhost!
What to do ? Edit the callback url in your twitter app.
Problem? Doesn't like localhost urls with ports in it (possibly disliking everything localhost in general).
What to do, then ? Encode your localhost url in a url shortener!
Example: http://localhost:3000/auth/twitter/callback
=> http://goo.gl/O5v3O
I used Google's URL shortener (@ http://goo.gl/ ) - simply set the address given by your URL-shortener of choice as the value of "Website: " under "Application Details".
Done and done.
PS!: Ryan didn't explicitly say this, but to use the ENV['TWITTER_SECRET'] etc you can set these values under environments/{development.rb,production.rb} like so:
ENV['TWITTER_SECRET'] = 'ssssh it is a SECRET!'
+1
John,
I would like to do a very similar thing with DataTables. Have you made any progress in how to display data from associated tables using server side processing?
--Rick
This is great! But I am having a bit of an issue. I can not seem to get it to bypass the password as easily as it should be.
I am allowing login via facebook using the information from this railscasts. My resource is :subscriber instead of :user, but the rest is pretty much the same.
and my model contains:
When I run debugger and interject immediately before
subscriber.persisted?
I can see I have a provider and a uid for subscriber, butsubscriber.persisted?
returns false becausesubscriber.new_record?
is true.What am I missing?
maybe a bit off subject but i am using omniauth to collect linked in profile data and am a bit stuck when it comes to getting info outside the - raise request.env["omniauth.auth"].to_yaml
I am trying to gain as much info as possible about signed in users such as past positions and location
here is the current user.rb save/create code
any help would be appreciated
Robbie
ps. i have had a look at this link but not sure how to go about getting the values into the db - [https://developer.linkedin.com/documents/profile-fields#profile]
Looks like a great app!
I couldn't get it to work in my development environment, described in short the problem here:
http://community.miniprofiler.com/permalinks/85/rails-no-such-file-to-load----rack-mini-profiler-loaderror
Any hint?
Sweet thanks! :)
got it to work by downloading and manually installing the zip from github sunspot.
hii everyone,
is password.present? necessary since validates_prescence_of :password, :on => :create already takes care of that?
+1 recommend 7 Databases.
Another great screencast Ryan!
If anyone's looking for a good book to read on DBs, PragProg's 7 Databases in 7 Weeks is excellent. Which reminds me I need to finish it!
I'm trying this line
but I get this error "SyntaxError in xxxController#index"
syntax error, unexpected ',', expecting ')'
I get this error when adding the "view_context"
I'm using rails 3.2.5
I was actually looking for a solution how to eagerly-load if the user voted on the answer, so that I can display a list of answers and tell if the user voted on them without doing the additional query.
I guess this could be done with some joins, but I wasn't able to do it with the activerecord-reputation-system.
Did anyone manage to do this?
Won't this result in n+1 problems, where you're doing a query for each answer?
Same here 0.11 to 0.14 fixed this...
Thanks!
BTW, http://fullware.net/prevent-rails-session-hijack-in-warden/ gives 404 error.
Unfortunately it seems to be impossible to set up Sunspot and Solr on Windows. Running rake sunspot:solr:run works fine, however, when trying to reindex or if on server development mode and perform the search method, you get the exception "No connection could be made because the target machine actively refused it. - connect(2)". I installed sunspot_rails and sunspot_solr today, so it should be the latest versions. Updated java as well today to 1.7.0_05. Now, here some people get it working by changing line 104 in server.rb from exec(Shellwords.shelljoin(command)) to system(Shellwords.shelljoin(command)), but this doesn't work for me either. I don't really see any possible solution left to try. Does anybody have an idea how to get it work on windows 7?
Thanks for this! I was about to go search the Interwebz...Great screencast, Ryan!
No
one data store
to rule them all. Different ones for different big data problems in the same application.Can you try using latest, I think I sorted this out
All those who were having trouble, can you test again on 0.1.8, quite a few important fixes there
+1 for coverage of the Rails OOP movement & how to achieve fast tests
Hello! noob here, how do you add a "remove" item for this?? Thanks!
Has anyone seen how to do associated_against with UUIDs? I am getting this error.
PG::Error: ERROR: operator does not exist: uuid = character varying
LINE 1: ...M "articles" INNER JOIN "forums" ON "forums"."id" = "article...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Awesome Railscast!
Just wanted to mention that in the Mongo Shell you can use
.pretty()
at the end of your query, so you can get the pretty-printed output in mongo shell. This is similar to what you would get with "awesome_print" in irb or the rails console.I've got my app setup to have multiple organizations, and multiple pages per organization (identified via the subdomain). Is it possible to have FriendlyId check for uniqueness only on a per-user basis?
Thus that there can be multiple /home pages, but are unique within a given organization.
They did wrong. That's true, MongoDB is not very good for abstracting complex social network structures. But MySQL is not any better either! For that class of problems the best solution is graph database. http://www.infoq.com/presentations/emil-eifrem-neo4j. (for Rails: http://neo4j.rubyforge.org/guides/rails3.html)