Querying a many_to_many relationship for associated data

2015-04-15 Thread Elanor Riley
I have the following tables: create_table(:tours) do primary_key :id String :group_type, :null = false String :group_name String :group_fname, :null = false String :group_lname, :null = false, :index = true String :group_email, :null = false String :group_phone, :null = false end

Re: Querying a many_to_many relationship for associated data

2015-04-17 Thread Elanor Riley
Thank you for the response, Jeremy! I had good success using group_concat in order to collect my tour guide names, but the answer that I settled on had been staring me in the face the whole time. I needed the output as a JSON object, and I was already using the json_serializer plugin. Using

Re: Conditional Validation With Message

2015-04-06 Thread Elanor Riley
Thank you Jeremy! On Friday, April 3, 2015 at 5:35:12 PM UTC-4, Jeremy Evans wrote: You were close: validates_presence [:tour_guide, :accepted_date], :message = Tour Guide and Accepted Date must be set in order to approve a request. if status == 2 Thanks, Jeremy -- You received this

Conditional Validation With Message

2015-04-03 Thread Elanor Riley
Greetings! I have the following model in my code, but I cannot get the conditional validation on multiple columns to work with a custom message. class Form Sequel::Model(:requests) one_to_many :comments one_to_one :tour_guide def validate super validates_presence [:tour_guide,

Table Prefixing

2016-12-01 Thread Elanor Riley
Hello! I am writing an app that is limited to work within an existing database, therefore some of the table names may collide. Is there a way to assign a table prefix so that migrations / etc create, for example *newapp_users* rather than *users*? For example, active record has

Re: Table Prefixing

2016-12-01 Thread Elanor Riley
Jeremy, you never cease to amaze. Thank you so much. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To post to this

Re: Adding arbitrary parameters to json output

2017-06-14 Thread Elanor Riley
Hey guys, I'm glad that this has gotten a robust discussion going. I'm not sure I fully explained what I actually need to be done. I'm using the jQuery datatables plugin, and for server-side filtering, it requires some extra data in the JSON extract that doesn't come from a .to_json call on a

Very strange error in test environment, more descriptive error message?

2018-05-23 Thread Elanor Riley
So I just ran into an infuriating error while running my tests and I'm unsure if the error message can be improved to help someone in my position for the next time. Situation: I have a model. I'm writing a test to ensure the model is valid. My model has a validation like so: def validate

Re: Postgres AdapterNotFound Error

2018-02-16 Thread Elanor Riley
Thanks Jeremy! You're right that fixed it. And yes, this is a pretty legacy app that hasn't been touched in a while. On Thursday, February 15, 2018 at 5:47:54 PM UTC-5, Jeremy Evans wrote: > > On Thursday, February 15, 2018 at 1:52:12 PM UTC-8, Elanor Riley wrote: >> >>

Postgres AdapterNotFound Error

2018-02-15 Thread Elanor Riley
I'm in the process of converting one of my apps from using Mysql to using Postgres so that it can be hosted on heroku but I'm getting an error that the postgres adapter is not found for sequel. I have all the required gems installed I believe. Here's the relevant excerpt from Gemfile and

to_json options ignored when adding associations (eager vs eager_graph)

2018-08-31 Thread Elanor Riley
I'm experiencing some weird behavior with to_json and eager loading and eager graph. Everything works well with eager loaded relationships and to_json on a model, for instance Order.eager(:invoice, :confirmations, :user) .to_json( { :except => [:sales_line, :table_dlv_addr],

Multiple where conditions with AND and OR

2019-04-02 Thread Elanor Riley
I need to add multiple where statements, linked with AND, but also include a where statement with several conditions linked by OR What I want to generate: SELECT column1, column2 FROM table1 WHERE item_id IN (12345, 23456) AND account_num = 'ACCT01' AND ( (from_date IS NULL AND to_date IS