Posts by cassioscabral • 282 points
11 posts
-
1
votes2
answers1254
viewsQ: Model validation when update_attributes in Rails
I want to know how to validate my model for when @model.update_attributes(params) in my controller is called to return a possible error or false that seems to be the default returned by…
-
0
votes1
answer316
viewsQ: Update User Devise via API Securely
In an app I need to edit the registration data of a user such as name, email, phone and password (for the optional password, I found this solution). However this change is made via API. Since it…
ruby-on-railsasked cassioscabral 282 -
0
votes1
answer640
viewsA: Passing parameters to the as_json method
I was able to find the solution: On my controller: render :json => @schedules.as_json({:date => date}) In my model: def as_json(options = nil) hash = super(options) if options.has_key?(:date)…
-
4
votes1
answer640
viewsQ: Passing parameters to the as_json method
I am trying to pass parameters to the as_json method (overwriting the method) in my model. Because only with the date that comes from the user can I return my result. According to this past date I…
-
1
votes1
answer418
viewsA: Active admin and Devise in the application
After some restarts in my app magically came back to work. Still a strange bug. I searched and found this element that talks about it, in case something like this ever happens:…
-
1
votes1
answer418
viewsQ: Active admin and Devise in the application
In this app I am working in I use active admin and in the application I use Devise. Both use it for login. When I logout the /admin I am redirected to the main screen of the end user that starts…
-
1
votes1
answer358
viewsQ: Contact form and newsletter Ideal
I would love to know what would be the ideal framework/api to handle contact and newsletter forms on a simple page with information about a company’s services. There is a field to subscribe to the…
-
2
votes1
answer135
viewsA: What is the best method in Rails to create a self-reported category?
You can see this Gem ancestry How you want a model that self-references, more specifically for category and since it is to build a tree. The Gem ancestry has already been made for this kind of case.…
-
0
votes2
answers114
viewsA: Error when running implementation test
I think you should run Bundle install(or update) locally (on your pc), as the error in the build suggests, so the bundler will update Gemfile.lock. Commit and push after. In Travis' documentation it…
-
1
votes2
answers445
viewsA: How to query a polymorphic relationship in Rails 3/4?
Whereas you are looking for alternatives to the query, you could use the Gem https://github.com/pluginaweek/state_machine With state control and the ability to execute methods in changing from one…
-
4
votes2
answers546
viewsQ: Ruby Bematech integration (or similar)
Has anyone ever done a Ruby integration with a Bematech printer or other such ? What Gems or ways to print on a tax printer ?