The cache keys need to be unique in order to fetch its value later on.
So category_id is different for each category.
Think of the array [:category, category_id, :name] as syntactic sugar for what ends up being a cache key string.
For example:
ruby
"category/3/name"# the key that caches the category's name for the category_id 3"category/4/name"# the key that caches the category's name for the category_id 4"category/5/name"# the key that caches the category's name for the category_id 5
Hi everyone, I got a question will trying to use omniauth-facebook with devise
I followed the video(just substitute twitter with facebook) and was able to get it work.
However, I would like to customize my routes a little bit, so this is what I did:
as I expected, in my url "users/..." was changed to "accounts/...", but when I tried to login via facebook, I got this error: Routing Error No route matches [GET] "/users/auth/facebook/callback"
after play around with it, I got around it by adding this line:
config/routes.rb
get '/users/auth/facebook/callback', to: redirect('/accounts/auth/facebook/callback')
It works fine now, but I think there must be better solution.
Is there any way to change the returned callback url from /users/auth/facebook/callback to /accounts/auth/facebook/callback ???
Just an update - the issue appeared to be that the SMTP was not set up correctly. To rectify: you'll need to ensure your gem mail is set in your Gemfile. Next, create a setup_mail.rb file in config/initializers.
I realize this is 2 years (over) ago, but I thought I'd say I have the same problem. I found there was no .gitignore file so I created it with the README details, with no luck in an app I was working with called launchpage-rails. Seems to be a lack of config for the app.
I'm having the same issue now. I get a "TypeError: Object [object Object] has no method 'best_in_place'" from the dom ready call. Did you ever figure it out?
I don't whether this is a problem of my own, just in case:
The content of og:type meta tag should be video.movie, instead of cinematron:movie.
I don't know the reason, the latter one just doesn't work for me.
Just tried Metrical with a Rails 3.2.12 project and failed miserably. Found out that MetricFu had a new version, installed normally through Bundler and worked perfectly!
It seems that one of the things rspec-rails does is to add 'test:prepare' as a dependency to the test task. Commented it in the activerecord databases.rake to check and it's accountable for 2 seconds here.
Still cannot figure out where the other 2 seconds goes.
Using delayed_job gem with my rails 3 app on development working great but when I tried to use it on production using capistrano it gives me these error
script/delayed_job: Permission denied
I am using their method and I followed your method
I have an issue that each time I close my browser, I get signed out from my website and have to log in again on revisit. I do keep signed in at facebook.com...
If you're getting NoMethodError: undefined method[]' for nil:NilClass errors in the nginx compile:
Looks like as of Chef 11, you need to add depends 'nginx' to a metadata.rb file if you do an 'include_recipe'. (In this example, the medata.rb would be in the 'main' recipe directory.) See http://tickets.opscode.com/browse/COOK-2342
This is not necessary if you just add the recipe to your runlist in the node.json file.
The cache keys need to be unique in order to fetch its value later on.
So
category_id
is different for each category.Think of the array
[:category, category_id, :name]
as syntactic sugar for what ends up being a cache key string.For example:
and so on...
follow the instructions for the gem https://github.com/seyhunak/twitter-bootstrap-rails#installing-the-less-stylesheets
the first option, including 'therubyracer', 'less-rails' and 'twitter-bootstrap-rails' worked for me. The second didn't.
+1
I see, it's all in the arrange!
https://github.com/stefankroes/ancestry#arrangement
A year late, but thanks!
I want to know how to post image
I'm having difficulty finding out how to go about ordering the sub-tree navigation alphabetically?
+1
+1
This is because Rails 4 uses Strong Parameters checking in the controller instead of the attr_accessible method in the model.
In order to use the code in this cast for Rails 4, you'll need to replace the code snippet here:
With something that looks like this:
Disclaimer: I'm not sure this qualifies as 'The Rails Way'. If someone has a more elegant solution, please post a reply.
How would you go about adding the ID after the name if it is not unique?
It turns out this is a stupid question...
I figured it out, in
facebook.js.coffee
just change the window locationHi everyone, I got a question will trying to use omniauth-facebook with devise
I followed the video(just substitute twitter with facebook) and was able to get it work.
However, I would like to customize my routes a little bit, so this is what I did:
as I expected, in my url "users/..." was changed to "accounts/...", but when I tried to login via facebook, I got this error:
Routing Error
No route matches [GET] "/users/auth/facebook/callback"
after play around with it, I got around it by adding this line:
It works fine now, but I think there must be better solution.
Is there any way to change the returned callback url from
/users/auth/facebook/callback
to/accounts/auth/facebook/callback
???Thanks!
Thanks I was just about to post my newby mistake. :)
Added both (@user, task) since I was indexing associations in the parent object's index (aka "task")
As you are using nested resources you need to pass the task.
data-update-url="<%= sort_task_objectives_url(@task) %>"
I did try to add one other tooltip to the price field
But it's not working. The first tooltip is displayed on the 2 labels !
Any idea ?
Routing Error, help :)
No route matches {:action=>"sort", :controller=>"objectives", :profile_name=>"Codemaster"}
I did everything else as stated in the video.
data-update-url="<%= sort_task_objectives_url %>"
I do have
Thank you! xml.atom(:link... was what helped me.
Hello from 2013!
For rails 4 I am using the following code:
PostController:
def index
if params[:search]
@posts = Post.search(params[:search]).order("created_at DESC")
else
@posts = Post.all.order('created_at DESC')
end
end
Post model
def self.search(query)
# where(:title, query) -> This would return an exact match of the query
where("title like ?", "%#{query}%")
end
Index view:
<%= form_tag(posts_path, :method => "get", id: "search-form") do %>
<%= text_field_tag :search, params[:search], placeholder: "Search Posts" %>
<%= submit_tag "Search" %>
<% end %>
Good luck!
send("#{attr}=", params[attr])
Just an update - the issue appeared to be that the SMTP was not set up correctly. To rectify: you'll need to ensure your gem mail is set in your Gemfile. Next, create a setup_mail.rb file in config/initializers.
Change to your smtp of choice. Next include in your
And then... magic.
I realize this is 2 years (over) ago, but I thought I'd say I have the same problem. I found there was no .gitignore file so I created it with the README details, with no luck in an app I was working with called launchpage-rails. Seems to be a lack of config for the app.
I'm having the same issue now. I get a "TypeError: Object [object Object] has no method 'best_in_place'" from the dom ready call. Did you ever figure it out?
Does somebody has any idea how to use multiple dictionaries?
I don't whether this is a problem of my own, just in case:
The content of og:type meta tag should be video.movie, instead of cinematron:movie.
I don't know the reason, the latter one just doesn't work for me.
Just tried Metrical with a Rails 3.2.12 project and failed miserably. Found out that MetricFu had a new version, installed normally through Bundler and worked perfectly!
For people having issues with transferring their data using taps, here is my fix:
https://github.com/ricardochimal/taps/issues/128#issuecomment-21049046
Faye is really nice! However, in a lot of companies a lot of ports are blocked. So the setup breaks.
Is there a way to run my Rails app AND the Faye app on the same port (80)?
Am I missing something, or shouldn't the Receipe and Comment model both have the following included (based on (154 Polymorphic Association episode)?
If not, then I must be missing the point of this polymorphic association.
Thanks!
It seems that one of the things rspec-rails does is to add 'test:prepare' as a dependency to the test task. Commented it in the activerecord databases.rake to check and it's accountable for 2 seconds here.
Still cannot figure out where the other 2 seconds goes.
Why running tests with rspec is faster than with rake? What's rake doing unnecessarily?
this is a horrible name for the rails cast. Maybe "code coverage metrics" would make more sense.
Thank you so much! I was stuck at this point and could not figure out what should I do. Thx so much!!
Just a heads up. Cloudinary is expensive.
Anyone know how I can do a spec test about a csv export? Thanks
Using delayed_job gem with my rails 3 app on development working great but when I tried to use it on production using capistrano it gives me these error
script/delayed_job: Permission denied
I am using their method and I followed your method
https://github.com/collectiveidea/delayed_job/wiki/Rails-3-and-Capistrano
+1!
I have an issue that each time I close my browser, I get signed out from my website and have to log in again on revisit. I do keep signed in at facebook.com...
Anyone got any idea what is going on?
It seems like the Crop coordinates values are not being set.
This is what I get in my params hash after submitting:
"profile_photo"=>{"crop_x"=>"", "crop_y"=>"", "crop_w"=>"", "crop_h"=>""}, "commit"=>"Crop Photo", "user_id"=>"2", "profile_id"=>"2", "id"=>"7"}
Notice how all the crop_* are empty? What could be the reason?
I have both
attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
attr_accessible :crop_x, :crop_y, :crop_w, :crop_h
set.
That's far from getting actually hacked though and there's no loss of customer information.
+1
it doesnt work
Use
csv << product.attributes.values
instead of:
csv << product.attributes.values_at(*column_names)
Anyone else have problem with the pluralization?
This is in my store.js.coffee
But it is still looking for /entrys. Any thoughts?
It's working, so far its been smooth sailing. I also set the
data-turbolinks-track
attribute to true.<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
I'm running into the same issue. Did you ever find a solution for this?
If you're getting
NoMethodError: undefined method
[]' for nil:NilClass
errors in the nginx compile:Looks like as of Chef 11, you need to add
depends 'nginx'
to a metadata.rb file if you do an 'include_recipe'. (In this example, the medata.rb would be in the 'main' recipe directory.) See http://tickets.opscode.com/browse/COOK-2342This is not necessary if you just add the recipe to your runlist in the node.json file.
Hi all,
I have the same problem as http://stackoverflow.com/questions/15618099/multiple-delayed-job-processes-starting-same-job
I'm using: collectiveideas delayed_job 1.8.2, ruby ee 1.8.7 2012.02, pgbouncer + postgresql 9.2.
Regards
Where did you put that code?
Temp fix. while I'm trying to fix.
gem "rspec-rails", "2.13.2", :group => [:test, :development]
Bit of a cheat