Datatables is so much cleaner and provides multi-column searching. I have also created custom classes to define how datatables searches using some of the examples from one of your previous railscasts Ryan. Sometimes when it aint broke, don't fix it. :)
great railscast as usual. One note though.
In your cast you're caching the PermittedParams, which doesn't seem to be a good idea, since you're passing the params as an argument.
In development this will work, but in production you will end up with the PermittedParams holding the params from the very first request. Of course this applies to the user as well.
Maybe I'm missing something, so I'm glad to hear your opinion.
I am playing with data table following this guide.
But I feel the code in CoffeeScript was loaded before the html/haml code. So the jQuery select didn't find the .
Nothing happened after I load the page.
But when I type $('#provider-data-table').dataTable() on console, I can see the table. It is the same code in the CoffeeScript.
thanks.. it work's really nice for me, I think it can compare wit strong_parameters
it only supports ActiveRecord for now but I'm also writing on a MongoID adapter
Having to write a private method for every model where parameters are modified, and to hard-code the roles in there, seems to be very cumbersome and well, hard-coded. I like how you extracted this into a class.
I wish there was a tight integration with declarative_authorization, where the roles and permissions live in a separate configuration file and can be more easily changed in one location.
Great cast, really helped me secure my API. One question, how can I pass a token and userid with a request for authenticate_or_request_with_http_token so I can always match a token to a user?
Where is the require method defined on the params hash? It seems like a useful method, but I couldn't find it in the rails API or the ruby hash documentation.
I am asking myself if I should remove CanCan from my Gemfile, use strong_parameters and implement everything else, CanCan did for me (like loading and authorizing the resources), from scratch.
Would be cool to abstract the PermittedParams class even more, so that it's methods are not tied to one model only. It might be even cool to have a CanCan like gem for attributes to more easily specify permissions - or combine this with CanCan. ;-)
Cancan works on a more coarse level than this. It grants/denies access to entire actions and also loads instance variables. So this can be used in addition, it doesn't replace CanCan.
I enjoyed this episode very much. I especially liked the idea of using a PermittedParameters class.
I'm not sure I like filtering the view using PermittedParameters. I can't say exactly what I don't like about it. I feel that is a job for cancan, or other authorization gem.
Joe asked this question on the sidekiq mailing list. Here are the responses:
By Darren Boyd:
It's possible this is a race condition with your ActiveRecord transactions.
If you are creating a job in an after_save (or after_create/update) callback, it's possible that sidekiq is starting the job before the database transaction is committed. Since the sidekiq doesn't see the DB change inside the job creator's transaction, the record isn't there (yet).
I used this tutorial for the free tier, and didn't even finish it due to errors, but I was still charged $40 at the end of the month for barely a couple days of using this service. I terminated my instances within a few days of using rubber. Even the default small instances are only $0.08/hr.
Please can someone tell me what I am doing wrong here?
This is a great idea for a new Railscast! Maybe Ryan could show us how to import contacts using OmniContacts or any other gem he believes is the most suitable.
Ryan, great revision to a classic railscast! quick question, are you using a different file browser for Textmate? I think i remember you saying something about it in a different episode, but forgot which one.
Thanks a lot for this video cast. It really helped me to understand the plugin which has used in my current project. I just wanted to know how can I let users change password? I tried some ways but I couldn't do it. Also when I run rake route I don't get any routes related to the user. I'd be glad if there's any other video cast or tutorial where I can find how to edit the password
Also having this problem...Unsure as to how to treat that initializer file.
Datatables is so much cleaner and provides multi-column searching. I have also created custom classes to define how datatables searches using some of the examples from one of your previous railscasts Ryan. Sometimes when it aint broke, don't fix it. :)
Hi Rian,
great railscast as usual. One note though.
In your cast you're caching the PermittedParams, which doesn't seem to be a good idea, since you're passing the params as an argument.
In development this will work, but in production you will end up with the PermittedParams holding the params from the very first request. Of course this applies to the user as well.
Maybe I'm missing something, so I'm glad to hear your opinion.
+1
Hi Elliot,
I am just about to embark on this exact same thing. Do you have any code examples you could share with regards to logging in with Devise /Backbone?
Any help would be greatly appreciated.
Kind regards,
Luke Byrne
Yes, it is possible. Just don't define any styles and you should be fine.
Is it possible to user paperclip to upload a pdf(no image, plz)?
and if it's possible, how can I do it?
I also want to do this, I found this link but I haven't tested it yet, maybe it works for you
Thanks guys for AXLSX ! It perfectly suits my needs !
According to a pull request, it looks like 4.0 will accept arrays in permit() params as hash values too, therefore in the example, you can write this:
Hi there,
I am playing with data table following this guide.
But I feel the code in CoffeeScript was loaded before the html/haml code. So the jQuery select didn't find the .
Nothing happened after I load the page.
But when I type $('#provider-data-table').dataTable() on console, I can see the table. It is the same code in the CoffeeScript.
Could you please help me?
Thanks,
Shanbo
See my answer above.
I found the answer to this. It's in the:
user.oauth_expires_at = Time.at(auth.credentials.expires_at)
For my account, auth.credentials.expires_at does not exist. So Time.at was converting nil. For my account, I only had:
auth.credentials.token
auth.credentials.expires
So put some validation checking in there for that line and you should be good to go.
Getting the same error. Jeesh.
UGH!!! I clean installed Mountain Lion, installed Rails Installer and now when I follow this tutorial, I get this:
Faraday::Error::ConnectionFailed
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
a uniform interface for ActiveRecord and Mongoid would be awesome!
thanks.. it work's really nice for me, I think it can compare wit strong_parameters
it only supports ActiveRecord for now but I'm also writing on a MongoID adapter
looks great! it's nice how this is still in the models, but uses the roles which are maintained somewhere else.
I find this solution pretty interesting. I also wrote a gem which handles attr_accessible to be more comfortable.
https://github.com/parcydo/alfred
great RailsCast!
Having to write a private method for every model where parameters are modified, and to hard-code the roles in there, seems to be very cumbersome and well, hard-coded. I like how you extracted this into a class.
I wish there was a tight integration with
declarative_authorization
, where the roles and permissions live in a separate configuration file and can be more easily changed in one location.Great cast, really helped me secure my API. One question, how can I pass a token and userid with a request for authenticate_or_request_with_http_token so I can always match a token to a user?
That is because mongoid gem only works with Ruby 1.9.3
See this link for more details:
http://mongoid.org/en/mongoid/docs/tips.html#ruby
It's actually defined in Strong Parameters:
https://github.com/rails/strong_parameters/blob/master/lib/action_controller/parameters.rb#L29
+1
+1 Please do this Ryan... I'm a pro customer too : ).
Is there a way of discounting certain fields in the drop down as i have a lot of foreign keys in the table that I want to search on?
Where is the require method defined on the params hash? It seems like a useful method, but I couldn't find it in the rails API or the ruby hash documentation.
I am asking myself if I should remove CanCan from my Gemfile, use strong_parameters and implement everything else, CanCan did for me (like loading and authorizing the resources), from scratch.
What do you think?
Nominating this article for an update.
Would be cool to abstract the PermittedParams class even more, so that it's methods are not tied to one model only. It might be even cool to have a CanCan like gem for attributes to more easily specify permissions - or combine this with CanCan. ;-)
Cancan works on a more coarse level than this. It grants/denies access to entire actions and also loads instance variables. So this can be used in addition, it doesn't replace CanCan.
I was wondering about that too. Is this supposed to be a replacement or alternative to using CanCan?
I enjoyed this episode very much. I especially liked the idea of using a PermittedParameters class.
I'm not sure I like filtering the view using PermittedParameters. I can't say exactly what I don't like about it. I feel that is a job for cancan, or other authorization gem.
diglett,
Did you create your instances using the AMI-Type : m1.small or any other option other than t1.micro?
The t1.micro is the free ami-type
Joe asked this question on the sidekiq mailing list. Here are the responses:
By Darren Boyd:
It's possible this is a race condition with your ActiveRecord transactions.
If you are creating a job in an after_save (or after_create/update) callback, it's possible that sidekiq is starting the job before the database transaction is committed. Since the sidekiq doesn't see the DB change inside the job creator's transaction, the record isn't there (yet).
There's a longer explanation and a solution here: http://rails-bestpractices.com/posts/695-use-after_commit
Hope that helps.
By Mike Perham (Creator of Sidekiq):
Yep, we see this all the time at The Clymb. The answer is to use
either after_commit or delay_for(5.seconds).
Came to this episode pretty late. I would also love to see an episode on Varnish cache with Rails.
Thanks Srinivas, this worked for me. My bellowing "Yeeeeesssss" is still reverberating through our home office.
Hi John,
Glad to hear you're making progress; such is not the case with me!
I've posted a long message describing my problem over at StackOverflow.com...my handle there is rixter.
I feel close to a solution, so would like to stay in touch. This could be a powerful tool for my project -- if I can get it working!
--Rick
Because if you notice on the outside of the if statment, you have the respond_to block, I ran into the same issue at first as well.
So if you don't wrap it in format.html { }, the action won't know what to do.
There is a good answer here at Stackoverflow. Basically it makes use of
polymorphic_url
andpolymorphic_path
Not working...
undefined method `add_evaluation' for nil:NilClass
Anyone know why the reputation system isn't providing this method?
I tried this solution and it didn't work for me. Perhaps I did something wrong.
I did however find this post, which suggested simply adding the callback url to your app on Twitter as
Couldn't get this working with pow though.
I used this tutorial for the free tier, and didn't even finish it due to errors, but I was still charged $40 at the end of the month for barely a couple days of using this service. I terminated my instances within a few days of using rubber. Even the default small instances are only $0.08/hr.
Please can someone tell me what I am doing wrong here?
Thanks!
Thanks for this episode. It's very clearly, but I have some error on this episode.
I asked on stackoverflow, but there're no one can answer me. Hope can help me. Thanks!
http://stackoverflow.com/questions/11793788/gem-koala-undefined-methods-get-object
This is a great idea for a new Railscast! Maybe Ryan could show us how to import contacts using OmniContacts or any other gem he believes is the most suitable.
render :crop brings me up to a BLANK PAGE,
“406 not acceptable” error
I have to wrap this in a format.html{}
Not sure why... but it works
You'll still need to split:
Ryan, great revision to a classic railscast! quick question, are you using a different file browser for Textmate? I think i remember you saying something about it in a different episode, but forgot which one.
If you're using acts-as-taggable-on and you're getting 'Validation failed: Context can't be blank', the following should work:
Thanks a lot for this video cast. It really helped me to understand the plugin which has used in my current project. I just wanted to know how can I let users change password? I tried some ways but I couldn't do it. Also when I run
rake route
I don't get any routes related to theuser
. I'd be glad if there's any other video cast or tutorial where I can find how to edit the passwordThanks a lot
Keep up the good work